repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
jenetics/jenetics | jenetics/src/main/java/io/jenetics/engine/EvolutionResult.java | EvolutionResult.compareTo | @Override
public int compareTo(final EvolutionResult<G, C> other) {
return _optimize.compare(_best.get(), other._best.get());
} | java | @Override
public int compareTo(final EvolutionResult<G, C> other) {
return _optimize.compare(_best.get(), other._best.get());
} | [
"@",
"Override",
"public",
"int",
"compareTo",
"(",
"final",
"EvolutionResult",
"<",
"G",
",",
"C",
">",
"other",
")",
"{",
"return",
"_optimize",
".",
"compare",
"(",
"_best",
".",
"get",
"(",
")",
",",
"other",
".",
"_best",
".",
"get",
"(",
")",
... | Compare {@code this} evolution result with another one, according the
populations best individual.
@param other the other evolution result to compare
@return a negative integer, zero, or a positive integer as this result
is less than, equal to, or greater than the specified result. | [
"Compare",
"{",
"@code",
"this",
"}",
"evolution",
"result",
"with",
"another",
"one",
"according",
"the",
"populations",
"best",
"individual",
"."
] | train | https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/engine/EvolutionResult.java#L274-L277 |
landawn/AbacusUtil | src/com/landawn/abacus/util/LongList.java | LongList.reduce | public <E extends Exception> long reduce(final long identity, final Try.LongBinaryOperator<E> accumulator) throws E {
if (isEmpty()) {
return identity;
}
long result = identity;
for (int i = 0; i < size; i++) {
result = accumulator.applyAsLong(result, elementData[i]);
}
return result;
} | java | public <E extends Exception> long reduce(final long identity, final Try.LongBinaryOperator<E> accumulator) throws E {
if (isEmpty()) {
return identity;
}
long result = identity;
for (int i = 0; i < size; i++) {
result = accumulator.applyAsLong(result, elementData[i]);
}
return result;
} | [
"public",
"<",
"E",
"extends",
"Exception",
">",
"long",
"reduce",
"(",
"final",
"long",
"identity",
",",
"final",
"Try",
".",
"LongBinaryOperator",
"<",
"E",
">",
"accumulator",
")",
"throws",
"E",
"{",
"if",
"(",
"isEmpty",
"(",
")",
")",
"{",
"retur... | This is equivalent to:
<pre>
<code>
if (isEmpty()) {
return identity;
}
long result = identity;
for (int i = 0; i < size; i++) {
result = accumulator.applyAsLong(result, elementData[i]);
}
return result;
</code>
</pre>
@param identity
@param accumulator
@return | [
"This",
"is",
"equivalent",
"to",
":",
"<pre",
">",
"<code",
">",
"if",
"(",
"isEmpty",
"()",
")",
"{",
"return",
"identity",
";",
"}"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/LongList.java#L1120-L1132 |
line/armeria | core/src/main/java/com/linecorp/armeria/internal/annotation/AnnotatedHttpServiceFactory.java | AnnotatedHttpServiceFactory.findPattern | private static String findPattern(Method method, Set<Annotation> methodAnnotations) {
String pattern = findFirst(method, Path.class).map(Path::value)
.orElse(null);
for (Annotation a : methodAnnotations) {
final String p = (String) invokeValueMethod(a);
if (DefaultValues.isUnspecified(p)) {
continue;
}
checkArgument(pattern == null,
"Only one path can be specified. (" + pattern + ", " + p + ')');
pattern = p;
}
if (pattern == null || pattern.isEmpty()) {
throw new IllegalArgumentException(
"A path pattern should be specified by @Path or HTTP method annotations.");
}
return pattern;
} | java | private static String findPattern(Method method, Set<Annotation> methodAnnotations) {
String pattern = findFirst(method, Path.class).map(Path::value)
.orElse(null);
for (Annotation a : methodAnnotations) {
final String p = (String) invokeValueMethod(a);
if (DefaultValues.isUnspecified(p)) {
continue;
}
checkArgument(pattern == null,
"Only one path can be specified. (" + pattern + ", " + p + ')');
pattern = p;
}
if (pattern == null || pattern.isEmpty()) {
throw new IllegalArgumentException(
"A path pattern should be specified by @Path or HTTP method annotations.");
}
return pattern;
} | [
"private",
"static",
"String",
"findPattern",
"(",
"Method",
"method",
",",
"Set",
"<",
"Annotation",
">",
"methodAnnotations",
")",
"{",
"String",
"pattern",
"=",
"findFirst",
"(",
"method",
",",
"Path",
".",
"class",
")",
".",
"map",
"(",
"Path",
"::",
... | Returns a specified path pattern. The path pattern might be specified by {@link Path} or
HTTP method annotations such as {@link Get} and {@link Post}. | [
"Returns",
"a",
"specified",
"path",
"pattern",
".",
"The",
"path",
"pattern",
"might",
"be",
"specified",
"by",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/internal/annotation/AnnotatedHttpServiceFactory.java#L559-L576 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.placeHolder | public SDVariable placeHolder(String name, org.nd4j.linalg.api.buffer.DataType dataType, long...shape) {
SDVariable ret = new SDVariable(name, VariableType.PLACEHOLDER, this, shape, dataType, null);
variables.put(name, Variable.builder().name(name).variable(ret).build());
return ret;
} | java | public SDVariable placeHolder(String name, org.nd4j.linalg.api.buffer.DataType dataType, long...shape) {
SDVariable ret = new SDVariable(name, VariableType.PLACEHOLDER, this, shape, dataType, null);
variables.put(name, Variable.builder().name(name).variable(ret).build());
return ret;
} | [
"public",
"SDVariable",
"placeHolder",
"(",
"String",
"name",
",",
"org",
".",
"nd4j",
".",
"linalg",
".",
"api",
".",
"buffer",
".",
"DataType",
"dataType",
",",
"long",
"...",
"shape",
")",
"{",
"SDVariable",
"ret",
"=",
"new",
"SDVariable",
"(",
"name... | Create a a placeholder variable. Placeholders are variables that expect an array to be provided during training
and inference.<br>
For example, the SDVariables for your input/features and labels should be placeholders.<br>
See also: {@link VariableType}
@param name the name of the variable
@param dataType Data type of the new placeholder
@param shape the shape of the variable if any
@return SDVariable placeholder | [
"Create",
"a",
"a",
"placeholder",
"variable",
".",
"Placeholders",
"are",
"variables",
"that",
"expect",
"an",
"array",
"to",
"be",
"provided",
"during",
"training",
"and",
"inference",
".",
"<br",
">",
"For",
"example",
"the",
"SDVariables",
"for",
"your",
... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L2057-L2061 |
phax/ph-commons | ph-datetime/src/main/java/com/helger/datetime/util/PDTHelper.java | PDTHelper.getEndWeekOfMonth | public static int getEndWeekOfMonth (@Nonnull final LocalDateTime aDT, @Nonnull final Locale aLocale)
{
return getWeekOfWeekBasedYear (aDT.plusMonths (1).withDayOfMonth (1).minusDays (1), aLocale);
} | java | public static int getEndWeekOfMonth (@Nonnull final LocalDateTime aDT, @Nonnull final Locale aLocale)
{
return getWeekOfWeekBasedYear (aDT.plusMonths (1).withDayOfMonth (1).minusDays (1), aLocale);
} | [
"public",
"static",
"int",
"getEndWeekOfMonth",
"(",
"@",
"Nonnull",
"final",
"LocalDateTime",
"aDT",
",",
"@",
"Nonnull",
"final",
"Locale",
"aLocale",
")",
"{",
"return",
"getWeekOfWeekBasedYear",
"(",
"aDT",
".",
"plusMonths",
"(",
"1",
")",
".",
"withDayOf... | Get the end-week number for the passed year and month.
@param aDT
The object to use year and month from.
@param aLocale
Locale to use. May not be <code>null</code>.
@return The end week number. | [
"Get",
"the",
"end",
"-",
"week",
"number",
"for",
"the",
"passed",
"year",
"and",
"month",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-datetime/src/main/java/com/helger/datetime/util/PDTHelper.java#L231-L234 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/BufferUtil.java | BufferUtil.readLine | public static String readLine(ByteBuffer buffer, Charset charset) {
final int startPosition = buffer.position();
final int endPosition = lineEnd(buffer);
if (endPosition > startPosition) {
byte[] bs = readBytes(buffer, startPosition, endPosition);
return StrUtil.str(bs, charset);
} else if (endPosition == startPosition) {
return StrUtil.EMPTY;
}
return null;
} | java | public static String readLine(ByteBuffer buffer, Charset charset) {
final int startPosition = buffer.position();
final int endPosition = lineEnd(buffer);
if (endPosition > startPosition) {
byte[] bs = readBytes(buffer, startPosition, endPosition);
return StrUtil.str(bs, charset);
} else if (endPosition == startPosition) {
return StrUtil.EMPTY;
}
return null;
} | [
"public",
"static",
"String",
"readLine",
"(",
"ByteBuffer",
"buffer",
",",
"Charset",
"charset",
")",
"{",
"final",
"int",
"startPosition",
"=",
"buffer",
".",
"position",
"(",
")",
";",
"final",
"int",
"endPosition",
"=",
"lineEnd",
"(",
"buffer",
")",
"... | 读取一行,如果buffer中最后一部分并非完整一行,则返回null<br>
支持的换行符如下:
<pre>
1. \r\n
2. \n
</pre>
@param buffer ByteBuffer
@param charset 编码
@return 一行 | [
"读取一行,如果buffer中最后一部分并非完整一行,则返回null<br",
">",
"支持的换行符如下:"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/BufferUtil.java#L204-L216 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java | Scanner.findWithinHorizon | public String findWithinHorizon(Pattern pattern, int horizon) {
ensureOpen();
if (pattern == null)
throw new NullPointerException();
if (horizon < 0)
throw new IllegalArgumentException("horizon < 0");
clearCaches();
// Search for the pattern
while (true) {
String token = findPatternInBuffer(pattern, horizon);
if (token != null) {
matchValid = true;
return token;
}
if (needInput)
readInput();
else
break; // up to end of input
}
return null;
} | java | public String findWithinHorizon(Pattern pattern, int horizon) {
ensureOpen();
if (pattern == null)
throw new NullPointerException();
if (horizon < 0)
throw new IllegalArgumentException("horizon < 0");
clearCaches();
// Search for the pattern
while (true) {
String token = findPatternInBuffer(pattern, horizon);
if (token != null) {
matchValid = true;
return token;
}
if (needInput)
readInput();
else
break; // up to end of input
}
return null;
} | [
"public",
"String",
"findWithinHorizon",
"(",
"Pattern",
"pattern",
",",
"int",
"horizon",
")",
"{",
"ensureOpen",
"(",
")",
";",
"if",
"(",
"pattern",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"if",
"(",
"horizon",
"<",
"... | Attempts to find the next occurrence of the specified pattern.
<p>This method searches through the input up to the specified
search horizon, ignoring delimiters. If the pattern is found the
scanner advances past the input that matched and returns the string
that matched the pattern. If no such pattern is detected then the
null is returned and the scanner's position remains unchanged. This
method may block waiting for input that matches the pattern.
<p>A scanner will never search more than <code>horizon</code> code
points beyond its current position. Note that a match may be clipped
by the horizon; that is, an arbitrary match result may have been
different if the horizon had been larger. The scanner treats the
horizon as a transparent, non-anchoring bound (see {@link
Matcher#useTransparentBounds} and {@link Matcher#useAnchoringBounds}).
<p>If horizon is <code>0</code>, then the horizon is ignored and
this method continues to search through the input looking for the
specified pattern without bound. In this case it may buffer all of
the input searching for the pattern.
<p>If horizon is negative, then an IllegalArgumentException is
thrown.
@param pattern the pattern to scan for
@param horizon the search horizon
@return the text that matched the specified pattern
@throws IllegalStateException if this scanner is closed
@throws IllegalArgumentException if horizon is negative | [
"Attempts",
"to",
"find",
"the",
"next",
"occurrence",
"of",
"the",
"specified",
"pattern",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java#L1641-L1662 |
infinispan/infinispan | commons/src/main/java/org/infinispan/commons/util/SaslUtils.java | SaslUtils.getSaslServerFactories | public static Iterator<SaslServerFactory> getSaslServerFactories(ClassLoader classLoader, boolean includeGlobal) {
return getFactories(SaslServerFactory.class, classLoader, includeGlobal);
} | java | public static Iterator<SaslServerFactory> getSaslServerFactories(ClassLoader classLoader, boolean includeGlobal) {
return getFactories(SaslServerFactory.class, classLoader, includeGlobal);
} | [
"public",
"static",
"Iterator",
"<",
"SaslServerFactory",
">",
"getSaslServerFactories",
"(",
"ClassLoader",
"classLoader",
",",
"boolean",
"includeGlobal",
")",
"{",
"return",
"getFactories",
"(",
"SaslServerFactory",
".",
"class",
",",
"classLoader",
",",
"includeGl... | Returns an iterator of all of the registered {@code SaslServerFactory}s where the order is based on the
order of the Provider registration and/or class path order. Class path providers are listed before
global providers; in the event of a name conflict, the class path provider is preferred.
@param classLoader the class loader to use
@param includeGlobal {@code true} to include globally registered providers, {@code false} to exclude them
@return the {@code Iterator} of {@code SaslServerFactory}s | [
"Returns",
"an",
"iterator",
"of",
"all",
"of",
"the",
"registered",
"{",
"@code",
"SaslServerFactory",
"}",
"s",
"where",
"the",
"order",
"is",
"based",
"on",
"the",
"order",
"of",
"the",
"Provider",
"registration",
"and",
"/",
"or",
"class",
"path",
"ord... | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/util/SaslUtils.java#L31-L33 |
jbundle/jbundle | thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/opt/JAltGridScreen.java | JAltGridScreen.init | public void init(Object parent, TableModel model)
{
super.init(parent, model);
this.setModel(model);
} | java | public void init(Object parent, TableModel model)
{
super.init(parent, model);
this.setModel(model);
} | [
"public",
"void",
"init",
"(",
"Object",
"parent",
",",
"TableModel",
"model",
")",
"{",
"super",
".",
"init",
"(",
"parent",
",",
"model",
")",
";",
"this",
".",
"setModel",
"(",
"model",
")",
";",
"}"
] | Constructor.
@param parent Typically, you pass the BaseApplet as the parent.
@param record and the record or GridTableModel as the parent. | [
"Constructor",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/opt/JAltGridScreen.java#L114-L118 |
javamelody/javamelody | javamelody-swing/src/main/java/net/bull/javamelody/swing/table/MDefaultTableCellRenderer.java | MDefaultTableCellRenderer.adjustRowHeight | protected void adjustRowHeight(final JTable table, final Component component, final int row) {
// Ajustement de la hauteur de cette ligne en fonction de la taille du renderer
final int cellHeight = table.getRowHeight(row);
final int rendererHeight = component.getPreferredSize().height;
if (cellHeight < rendererHeight - 4) { // dans le cas normal, cellHeight est à 16 et rendererHeight est à 20
table.setRowHeight(row, rendererHeight);
}
} | java | protected void adjustRowHeight(final JTable table, final Component component, final int row) {
// Ajustement de la hauteur de cette ligne en fonction de la taille du renderer
final int cellHeight = table.getRowHeight(row);
final int rendererHeight = component.getPreferredSize().height;
if (cellHeight < rendererHeight - 4) { // dans le cas normal, cellHeight est à 16 et rendererHeight est à 20
table.setRowHeight(row, rendererHeight);
}
} | [
"protected",
"void",
"adjustRowHeight",
"(",
"final",
"JTable",
"table",
",",
"final",
"Component",
"component",
",",
"final",
"int",
"row",
")",
"{",
"// Ajustement de la hauteur de cette ligne en fonction de la taille du renderer\r",
"final",
"int",
"cellHeight",
"=",
"... | Ajustement de la hauteur de cette ligne en fonction de la taille du renderer (ex: la taille d'une icône ou d'un label html).
@param table
JTable
@param component
Component
@param row
int | [
"Ajustement",
"de",
"la",
"hauteur",
"de",
"cette",
"ligne",
"en",
"fonction",
"de",
"la",
"taille",
"du",
"renderer",
"(",
"ex",
":",
"la",
"taille",
"d",
"une",
"icône",
"ou",
"d",
"un",
"label",
"html",
")",
"."
] | train | https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-swing/src/main/java/net/bull/javamelody/swing/table/MDefaultTableCellRenderer.java#L44-L51 |
beangle/beangle3 | commons/core/src/main/java/org/beangle/commons/lang/Assert.java | Assert.isTrue | public static void isTrue(boolean expression, String message, Object... values) {
if (!expression) { throw new IllegalArgumentException(String.format(message, values)); }
} | java | public static void isTrue(boolean expression, String message, Object... values) {
if (!expression) { throw new IllegalArgumentException(String.format(message, values)); }
} | [
"public",
"static",
"void",
"isTrue",
"(",
"boolean",
"expression",
",",
"String",
"message",
",",
"Object",
"...",
"values",
")",
"{",
"if",
"(",
"!",
"expression",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"... | <p>
Validate that the argument condition is {@code true}; otherwise throwing an exception with the
specified message. This method is useful when validating according to an arbitrary boolean
expression, such as validating a primitive number or using your own custom validation
expression.
</p>
<pre>
Assert.isTrue(i >= min && i <= max, "The value must be between %d and %d", min, max);
Assert.isTrue(myObject.isOk(), "The object is not okay");
</pre>
@param expression the boolean expression to check
@param message the {@link String#format(String, Object...)} exception message if invalid, not
null
@param values the optional values for the formatted exception message, null array not
recommended
@throws IllegalArgumentException if expression is {@code false}
@see #isTrue(boolean) | [
"<p",
">",
"Validate",
"that",
"the",
"argument",
"condition",
"is",
"{",
"@code",
"true",
"}",
";",
"otherwise",
"throwing",
"an",
"exception",
"with",
"the",
"specified",
"message",
".",
"This",
"method",
"is",
"useful",
"when",
"validating",
"according",
... | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/lang/Assert.java#L78-L80 |
lightblueseas/file-worker | src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java | CopyFileExtensions.copyFile | public static boolean copyFile(final File source, final File destination)
throws IOException, FileIsADirectoryException
{
return copyFile(source, destination, true);
} | java | public static boolean copyFile(final File source, final File destination)
throws IOException, FileIsADirectoryException
{
return copyFile(source, destination, true);
} | [
"public",
"static",
"boolean",
"copyFile",
"(",
"final",
"File",
"source",
",",
"final",
"File",
"destination",
")",
"throws",
"IOException",
",",
"FileIsADirectoryException",
"{",
"return",
"copyFile",
"(",
"source",
",",
"destination",
",",
"true",
")",
";",
... | Copies the given source file to the given destination file.
@param source
The source file.
@param destination
The destination file.
@return 's true if the file is copied, otherwise false.
@throws IOException
Is thrown if an error occurs by reading or writing.
@throws FileIsADirectoryException
Is thrown if the destination file is a directory. | [
"Copies",
"the",
"given",
"source",
"file",
"to",
"the",
"given",
"destination",
"file",
"."
] | train | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java#L484-L488 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/util/logging/OutputHandler.java | OutputHandler.styleChannel | public void styleChannel(String channel, Style style){
if(this.channelStyles == null){
this.channelStyles = new HashMap<String,Style>();
}
this.channelStyles.put(channel.toLowerCase(),style);
} | java | public void styleChannel(String channel, Style style){
if(this.channelStyles == null){
this.channelStyles = new HashMap<String,Style>();
}
this.channelStyles.put(channel.toLowerCase(),style);
} | [
"public",
"void",
"styleChannel",
"(",
"String",
"channel",
",",
"Style",
"style",
")",
"{",
"if",
"(",
"this",
".",
"channelStyles",
"==",
"null",
")",
"{",
"this",
".",
"channelStyles",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Style",
">",
"(",
")... | Style the tag for a particular channel this style
@param channel The channel to style
@param style The style to use | [
"Style",
"the",
"tag",
"for",
"a",
"particular",
"channel",
"this",
"style"
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/logging/OutputHandler.java#L93-L98 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/reflection/GobblinConstructorUtils.java | GobblinConstructorUtils.invokeFirstConstructor | @SafeVarargs
public static <T> T invokeFirstConstructor(Class<T> cls, List<Object>... constructorArgs)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
for (List<Object> args : constructorArgs) {
Class<?>[] parameterTypes = new Class[args.size()];
for (int i = 0; i < args.size(); i++) {
parameterTypes[i] = args.get(i).getClass();
}
if (ConstructorUtils.getMatchingAccessibleConstructor(cls, parameterTypes) != null) {
return ConstructorUtils.invokeConstructor(cls, args.toArray(new Object[args.size()]));
}
}
throw new NoSuchMethodException("No accessible constructor found");
} | java | @SafeVarargs
public static <T> T invokeFirstConstructor(Class<T> cls, List<Object>... constructorArgs)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
for (List<Object> args : constructorArgs) {
Class<?>[] parameterTypes = new Class[args.size()];
for (int i = 0; i < args.size(); i++) {
parameterTypes[i] = args.get(i).getClass();
}
if (ConstructorUtils.getMatchingAccessibleConstructor(cls, parameterTypes) != null) {
return ConstructorUtils.invokeConstructor(cls, args.toArray(new Object[args.size()]));
}
}
throw new NoSuchMethodException("No accessible constructor found");
} | [
"@",
"SafeVarargs",
"public",
"static",
"<",
"T",
">",
"T",
"invokeFirstConstructor",
"(",
"Class",
"<",
"T",
">",
"cls",
",",
"List",
"<",
"Object",
">",
"...",
"constructorArgs",
")",
"throws",
"NoSuchMethodException",
",",
"IllegalAccessException",
",",
"In... | Convenience method on top of {@link ConstructorUtils#invokeConstructor(Class, Object[])} that returns a new
instance of the <code>cls</code> based on a constructor priority order. Each {@link List} in the
<code>constructorArgs</code> array contains the arguments for a constructor of <code>cls</code>. The first
constructor whose signature matches the argument types will be invoked.
@param cls the class to be instantiated
@param constructorArgs An array of constructor argument list. Order defines the priority of a constructor.
@return
@throws NoSuchMethodException if no constructor matched was found | [
"Convenience",
"method",
"on",
"top",
"of",
"{",
"@link",
"ConstructorUtils#invokeConstructor",
"(",
"Class",
"Object",
"[]",
")",
"}",
"that",
"returns",
"a",
"new",
"instance",
"of",
"the",
"<code",
">",
"cls<",
"/",
"code",
">",
"based",
"on",
"a",
"con... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/reflection/GobblinConstructorUtils.java#L46-L62 |
indeedeng/util | urlparsing/src/main/java/com/indeed/util/urlparsing/ParseUtils.java | ParseUtils.parseTimestampFromUIDString | public static long parseTimestampFromUIDString(String s, final int start, final int end) {
long ret = 0;
for (int i = start; i < end && i < start + 9; i++) {
ret <<= 5;
char c = s.charAt(i);
if (c >= '0' && c <= '9') {
ret |= c - '0';
} else if (c >= 'a' && c <= 'v') {
ret |= c - 'a' + 10;
} else if (c >= 'A' && c <= 'V') {
ret |= c - 'A' + 10;
} else {
throw new IllegalArgumentException(s.substring(start, end) + " is not a valid UID!");
}
}
return ret;
} | java | public static long parseTimestampFromUIDString(String s, final int start, final int end) {
long ret = 0;
for (int i = start; i < end && i < start + 9; i++) {
ret <<= 5;
char c = s.charAt(i);
if (c >= '0' && c <= '9') {
ret |= c - '0';
} else if (c >= 'a' && c <= 'v') {
ret |= c - 'a' + 10;
} else if (c >= 'A' && c <= 'V') {
ret |= c - 'A' + 10;
} else {
throw new IllegalArgumentException(s.substring(start, end) + " is not a valid UID!");
}
}
return ret;
} | [
"public",
"static",
"long",
"parseTimestampFromUIDString",
"(",
"String",
"s",
",",
"final",
"int",
"start",
",",
"final",
"int",
"end",
")",
"{",
"long",
"ret",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"start",
";",
"i",
"<",
"end",
"&&",
"i",
... | Parses out the timestamp portion of the uid Strings used in the logrepo | [
"Parses",
"out",
"the",
"timestamp",
"portion",
"of",
"the",
"uid",
"Strings",
"used",
"in",
"the",
"logrepo"
] | train | https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/urlparsing/src/main/java/com/indeed/util/urlparsing/ParseUtils.java#L180-L196 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/tracker/meanshift/LocalWeightedHistogramRotRect.java | LocalWeightedHistogramRotRect.computeHistogramBorder | protected void computeHistogramBorder(T image, RectangleRotate_F32 region) {
for( int i = 0; i < samplePts.size(); i++ ) {
Point2D_F32 p = samplePts.get(i);
squareToImageSample(p.x, p.y, region);
// make sure its inside the image
if( !BoofMiscOps.checkInside(image, imageX, imageY)) {
sampleHistIndex[ i ] = -1;
} else {
// use the slower interpolation which can handle the border
interpolate.get(imageX, imageY, value);
int indexHistogram = computeHistogramBin(value);
sampleHistIndex[ i ] = indexHistogram;
histogram[indexHistogram] += weights[i];
}
}
} | java | protected void computeHistogramBorder(T image, RectangleRotate_F32 region) {
for( int i = 0; i < samplePts.size(); i++ ) {
Point2D_F32 p = samplePts.get(i);
squareToImageSample(p.x, p.y, region);
// make sure its inside the image
if( !BoofMiscOps.checkInside(image, imageX, imageY)) {
sampleHistIndex[ i ] = -1;
} else {
// use the slower interpolation which can handle the border
interpolate.get(imageX, imageY, value);
int indexHistogram = computeHistogramBin(value);
sampleHistIndex[ i ] = indexHistogram;
histogram[indexHistogram] += weights[i];
}
}
} | [
"protected",
"void",
"computeHistogramBorder",
"(",
"T",
"image",
",",
"RectangleRotate_F32",
"region",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"samplePts",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"Point2D_F32",
"p",
"=",
... | Computes the histogram and skips pixels which are outside the image border | [
"Computes",
"the",
"histogram",
"and",
"skips",
"pixels",
"which",
"are",
"outside",
"the",
"image",
"border"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/meanshift/LocalWeightedHistogramRotRect.java#L176-L195 |
sarl/sarl | contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java | PyExpressionGenerator.newFeatureCallGenerator | protected PyFeatureCallGenerator newFeatureCallGenerator(IExtraLanguageGeneratorContext context, IAppendable it) {
return new PyFeatureCallGenerator(context, (ExtraLanguageAppendable) it);
} | java | protected PyFeatureCallGenerator newFeatureCallGenerator(IExtraLanguageGeneratorContext context, IAppendable it) {
return new PyFeatureCallGenerator(context, (ExtraLanguageAppendable) it);
} | [
"protected",
"PyFeatureCallGenerator",
"newFeatureCallGenerator",
"(",
"IExtraLanguageGeneratorContext",
"context",
",",
"IAppendable",
"it",
")",
"{",
"return",
"new",
"PyFeatureCallGenerator",
"(",
"context",
",",
"(",
"ExtraLanguageAppendable",
")",
"it",
")",
";",
"... | Generate a feature call.
@param context the generation context.
@param it the code receiver.
@return the generator | [
"Generate",
"a",
"feature",
"call",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java#L1028-L1030 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/remote/RemoteProxyController.java | RemoteProxyController.translateOperationForProxy | public ModelNode translateOperationForProxy(final ModelNode op) {
return translateOperationForProxy(op, PathAddress.pathAddress(op.get(OP_ADDR)));
} | java | public ModelNode translateOperationForProxy(final ModelNode op) {
return translateOperationForProxy(op, PathAddress.pathAddress(op.get(OP_ADDR)));
} | [
"public",
"ModelNode",
"translateOperationForProxy",
"(",
"final",
"ModelNode",
"op",
")",
"{",
"return",
"translateOperationForProxy",
"(",
"op",
",",
"PathAddress",
".",
"pathAddress",
"(",
"op",
".",
"get",
"(",
"OP_ADDR",
")",
")",
")",
";",
"}"
] | Translate the operation address.
@param op the operation
@return the new operation | [
"Translate",
"the",
"operation",
"address",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/remote/RemoteProxyController.java#L251-L253 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/bci/CheckInstrumentableClassAdapter.java | CheckInstrumentableClassAdapter.isInstrumentableMethod | public boolean isInstrumentableMethod(int access, String methodName, String descriptor) {
if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
return false;
}
if ((access & Opcodes.ACC_NATIVE) != 0) {
return false;
}
if ((access & Opcodes.ACC_ABSTRACT) != 0) {
return false;
}
if (methodName.equals("toString") && descriptor.equals("()Ljava/lang/String;")) {
return false;
}
if (methodName.equals("hashCode") && descriptor.equals("()I")) {
return false;
}
return true;
} | java | public boolean isInstrumentableMethod(int access, String methodName, String descriptor) {
if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
return false;
}
if ((access & Opcodes.ACC_NATIVE) != 0) {
return false;
}
if ((access & Opcodes.ACC_ABSTRACT) != 0) {
return false;
}
if (methodName.equals("toString") && descriptor.equals("()Ljava/lang/String;")) {
return false;
}
if (methodName.equals("hashCode") && descriptor.equals("()I")) {
return false;
}
return true;
} | [
"public",
"boolean",
"isInstrumentableMethod",
"(",
"int",
"access",
",",
"String",
"methodName",
",",
"String",
"descriptor",
")",
"{",
"if",
"(",
"(",
"access",
"&",
"Opcodes",
".",
"ACC_SYNTHETIC",
")",
"!=",
"0",
")",
"{",
"return",
"false",
";",
"}",
... | Indicate whether or not the target method is instrumentable.
@param access
the method property flags
@param methodName
the name of the method
@return true if the method is not synthetic, is not native, and is
not named toString or hashCode. | [
"Indicate",
"whether",
"or",
"not",
"the",
"target",
"method",
"is",
"instrumentable",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/bci/CheckInstrumentableClassAdapter.java#L108-L125 |
GoogleCloudPlatform/bigdata-interop | bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/AbstractBigQueryInputFormat.java | AbstractBigQueryInputFormat.cleanupJob | public static void cleanupJob(Configuration configuration, JobID jobId) throws IOException {
String exportPathRoot = BigQueryConfiguration.getTemporaryPathRoot(configuration, jobId);
configuration.set(BigQueryConfiguration.TEMP_GCS_PATH_KEY, exportPathRoot);
Bigquery bigquery = null;
try {
bigquery = new BigQueryFactory().getBigQuery(configuration);
} catch (GeneralSecurityException gse) {
throw new IOException("Failed to create Bigquery client", gse);
}
cleanupJob(new BigQueryHelper(bigquery), configuration);
} | java | public static void cleanupJob(Configuration configuration, JobID jobId) throws IOException {
String exportPathRoot = BigQueryConfiguration.getTemporaryPathRoot(configuration, jobId);
configuration.set(BigQueryConfiguration.TEMP_GCS_PATH_KEY, exportPathRoot);
Bigquery bigquery = null;
try {
bigquery = new BigQueryFactory().getBigQuery(configuration);
} catch (GeneralSecurityException gse) {
throw new IOException("Failed to create Bigquery client", gse);
}
cleanupJob(new BigQueryHelper(bigquery), configuration);
} | [
"public",
"static",
"void",
"cleanupJob",
"(",
"Configuration",
"configuration",
",",
"JobID",
"jobId",
")",
"throws",
"IOException",
"{",
"String",
"exportPathRoot",
"=",
"BigQueryConfiguration",
".",
"getTemporaryPathRoot",
"(",
"configuration",
",",
"jobId",
")",
... | Cleans up relevant temporary resources associated with a job which used the
GsonBigQueryInputFormat; this should be called explicitly after the completion of the entire
job. Possibly cleans up intermediate export tables if configured to use one due to
specifying a BigQuery "query" for the input. Cleans up the GCS directoriy where BigQuery
exported its files for reading. | [
"Cleans",
"up",
"relevant",
"temporary",
"resources",
"associated",
"with",
"a",
"job",
"which",
"used",
"the",
"GsonBigQueryInputFormat",
";",
"this",
"should",
"be",
"called",
"explicitly",
"after",
"the",
"completion",
"of",
"the",
"entire",
"job",
".",
"Poss... | train | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/AbstractBigQueryInputFormat.java#L207-L217 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.license_cpanel_new_GET | public ArrayList<String> license_cpanel_new_GET(String ip, OvhLicenseTypeEnum serviceType, OvhOrderableCpanelVersionEnum version) throws IOException {
String qPath = "/order/license/cpanel/new";
StringBuilder sb = path(qPath);
query(sb, "ip", ip);
query(sb, "serviceType", serviceType);
query(sb, "version", version);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | java | public ArrayList<String> license_cpanel_new_GET(String ip, OvhLicenseTypeEnum serviceType, OvhOrderableCpanelVersionEnum version) throws IOException {
String qPath = "/order/license/cpanel/new";
StringBuilder sb = path(qPath);
query(sb, "ip", ip);
query(sb, "serviceType", serviceType);
query(sb, "version", version);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"license_cpanel_new_GET",
"(",
"String",
"ip",
",",
"OvhLicenseTypeEnum",
"serviceType",
",",
"OvhOrderableCpanelVersionEnum",
"version",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/license/cpanel/new\"",... | Get allowed durations for 'new' option
REST: GET /order/license/cpanel/new
@param serviceType [required] # DEPRECATED # The kind of service on which this license will be used # Will not be used, keeped only for compatibility #
@param ip [required] Ip on which this license would be installed
@param version [required] This license version | [
"Get",
"allowed",
"durations",
"for",
"new",
"option"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L1483-L1491 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/security/CredentialReference.java | CredentialReference.getAttributeBuilder | public static ObjectTypeAttributeDefinition.Builder getAttributeBuilder(String name, String xmlName,
boolean allowNull, boolean referenceCredentialStore) {
AttributeDefinition csAttr = referenceCredentialStore ? credentialStoreAttributeWithCapabilityReference : credentialStoreAttribute;
return getAttributeBuilder(name, xmlName, allowNull, csAttr);
} | java | public static ObjectTypeAttributeDefinition.Builder getAttributeBuilder(String name, String xmlName,
boolean allowNull, boolean referenceCredentialStore) {
AttributeDefinition csAttr = referenceCredentialStore ? credentialStoreAttributeWithCapabilityReference : credentialStoreAttribute;
return getAttributeBuilder(name, xmlName, allowNull, csAttr);
} | [
"public",
"static",
"ObjectTypeAttributeDefinition",
".",
"Builder",
"getAttributeBuilder",
"(",
"String",
"name",
",",
"String",
"xmlName",
",",
"boolean",
"allowNull",
",",
"boolean",
"referenceCredentialStore",
")",
"{",
"AttributeDefinition",
"csAttr",
"=",
"referen... | Get an attribute builder for a credential-reference attribute with the specified characteristics, optionally configured to
{@link org.jboss.as.controller.AbstractAttributeDefinitionBuilder#setCapabilityReference(String) register a requirement}
for a {@link #CREDENTIAL_STORE_CAPABILITY credential store capability}.
If a requirement is registered, the dependent capability will be the single capability registered by the
resource that uses this attribute definition. The resource must expose one and only one capability in order
to use this facility.
@param name name of attribute
@param xmlName name of xml element
@param allowNull {@code false} if the attribute is required
@param referenceCredentialStore {@code true} if the {@code store} field in the
attribute should register a requirement for a credential store capability.
@return an {@link ObjectTypeAttributeDefinition.Builder} which can be used to build an attribute definition | [
"Get",
"an",
"attribute",
"builder",
"for",
"a",
"credential",
"-",
"reference",
"attribute",
"with",
"the",
"specified",
"characteristics",
"optionally",
"configured",
"to",
"{",
"@link",
"org",
".",
"jboss",
".",
"as",
".",
"controller",
".",
"AbstractAttribut... | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/security/CredentialReference.java#L219-L223 |
Netflix/frigga | src/main/java/com/netflix/frigga/NameValidation.java | NameValidation.notEmpty | public static String notEmpty(String value, String variableName) {
if (value == null) {
throw new NullPointerException("ERROR: Trying to use String with null " + variableName);
}
if (value.isEmpty()) {
throw new IllegalArgumentException("ERROR: Illegal empty string for " + variableName);
}
return value;
} | java | public static String notEmpty(String value, String variableName) {
if (value == null) {
throw new NullPointerException("ERROR: Trying to use String with null " + variableName);
}
if (value.isEmpty()) {
throw new IllegalArgumentException("ERROR: Illegal empty string for " + variableName);
}
return value;
} | [
"public",
"static",
"String",
"notEmpty",
"(",
"String",
"value",
",",
"String",
"variableName",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"ERROR: Trying to use String with null \"",
"+",
"variableName",
"... | Validates if provided value is non-null and non-empty.
@param value the string to validate
@param variableName name of the variable to include in error messages
@return the value parameter if valid, throws an exception otherwise | [
"Validates",
"if",
"provided",
"value",
"is",
"non",
"-",
"null",
"and",
"non",
"-",
"empty",
"."
] | train | https://github.com/Netflix/frigga/blob/38afefd1726116f3431b95fcb96a6af640b99d10/src/main/java/com/netflix/frigga/NameValidation.java#L41-L49 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.replaceResource | @SuppressWarnings("javadoc")
public void replaceResource(
CmsDbContext dbc,
CmsResource resource,
int type,
byte[] content,
List<CmsProperty> properties)
throws CmsException {
// replace the existing with the new file content
getVfsDriver(dbc).replaceResource(dbc, resource, content, type);
if ((properties != null) && !properties.isEmpty()) {
// write the properties
getVfsDriver(dbc).writePropertyObjects(dbc, dbc.currentProject(), resource, properties);
m_monitor.flushCache(CmsMemoryMonitor.CacheType.PROPERTY, CmsMemoryMonitor.CacheType.PROPERTY_LIST);
}
// update the resource state
if (resource.getState().isUnchanged()) {
resource.setState(CmsResource.STATE_CHANGED);
}
resource.setUserLastModified(dbc.currentUser().getId());
// log it
log(
dbc,
new CmsLogEntry(
dbc,
resource.getStructureId(),
CmsLogEntryType.RESOURCE_CONTENT_MODIFIED,
new String[] {resource.getRootPath()}),
false);
setDateLastModified(dbc, resource, System.currentTimeMillis());
getVfsDriver(dbc).writeResourceState(dbc, dbc.currentProject(), resource, UPDATE_RESOURCE, false);
deleteRelationsWithSiblings(dbc, resource);
// clear the cache
m_monitor.clearResourceCache();
if ((properties != null) && !properties.isEmpty()) {
// resource and properties were modified
OpenCms.fireCmsEvent(
new CmsEvent(
I_CmsEventListener.EVENT_RESOURCE_AND_PROPERTIES_MODIFIED,
Collections.<String, Object> singletonMap(I_CmsEventListener.KEY_RESOURCE, resource)));
} else {
// only the resource was modified
Map<String, Object> data = new HashMap<String, Object>(2);
data.put(I_CmsEventListener.KEY_RESOURCE, resource);
data.put(I_CmsEventListener.KEY_CHANGE, new Integer(CHANGED_RESOURCE | CHANGED_CONTENT));
OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_RESOURCE_MODIFIED, data));
}
} | java | @SuppressWarnings("javadoc")
public void replaceResource(
CmsDbContext dbc,
CmsResource resource,
int type,
byte[] content,
List<CmsProperty> properties)
throws CmsException {
// replace the existing with the new file content
getVfsDriver(dbc).replaceResource(dbc, resource, content, type);
if ((properties != null) && !properties.isEmpty()) {
// write the properties
getVfsDriver(dbc).writePropertyObjects(dbc, dbc.currentProject(), resource, properties);
m_monitor.flushCache(CmsMemoryMonitor.CacheType.PROPERTY, CmsMemoryMonitor.CacheType.PROPERTY_LIST);
}
// update the resource state
if (resource.getState().isUnchanged()) {
resource.setState(CmsResource.STATE_CHANGED);
}
resource.setUserLastModified(dbc.currentUser().getId());
// log it
log(
dbc,
new CmsLogEntry(
dbc,
resource.getStructureId(),
CmsLogEntryType.RESOURCE_CONTENT_MODIFIED,
new String[] {resource.getRootPath()}),
false);
setDateLastModified(dbc, resource, System.currentTimeMillis());
getVfsDriver(dbc).writeResourceState(dbc, dbc.currentProject(), resource, UPDATE_RESOURCE, false);
deleteRelationsWithSiblings(dbc, resource);
// clear the cache
m_monitor.clearResourceCache();
if ((properties != null) && !properties.isEmpty()) {
// resource and properties were modified
OpenCms.fireCmsEvent(
new CmsEvent(
I_CmsEventListener.EVENT_RESOURCE_AND_PROPERTIES_MODIFIED,
Collections.<String, Object> singletonMap(I_CmsEventListener.KEY_RESOURCE, resource)));
} else {
// only the resource was modified
Map<String, Object> data = new HashMap<String, Object>(2);
data.put(I_CmsEventListener.KEY_RESOURCE, resource);
data.put(I_CmsEventListener.KEY_CHANGE, new Integer(CHANGED_RESOURCE | CHANGED_CONTENT));
OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_RESOURCE_MODIFIED, data));
}
} | [
"@",
"SuppressWarnings",
"(",
"\"javadoc\"",
")",
"public",
"void",
"replaceResource",
"(",
"CmsDbContext",
"dbc",
",",
"CmsResource",
"resource",
",",
"int",
"type",
",",
"byte",
"[",
"]",
"content",
",",
"List",
"<",
"CmsProperty",
">",
"properties",
")",
... | Replaces the content, type and properties of a resource.<p>
@param dbc the current database context
@param resource the name of the resource to apply this operation to
@param type the new type of the resource
@param content the new content of the resource
@param properties the new properties of the resource
@throws CmsException if something goes wrong
@see CmsObject#replaceResource(String, int, byte[], List)
@see I_CmsResourceType#replaceResource(CmsObject, CmsSecurityManager, CmsResource, int, byte[], List) | [
"Replaces",
"the",
"content",
"type",
"and",
"properties",
"of",
"a",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L8393-L8449 |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/util/Jsr250Utils.java | Jsr250Utils.inScope | public static boolean inScope(final Injector injector, final Binding<?> binding, final Class<? extends Annotation> scope) {
return binding.acceptScopingVisitor(new BindingScopingVisitor<Boolean>() {
@Override
public Boolean visitEagerSingleton() {
return scope == Singleton.class || scope == javax.inject.Singleton.class;
}
@Override
public Boolean visitNoScoping() {
return false;
}
@Override
public Boolean visitScope(Scope guiceScope) {
return injector.getScopeBindings().get(scope) == guiceScope;
}
@Override
public Boolean visitScopeAnnotation(Class<? extends Annotation> scopeAnnotation) {
return scopeAnnotation == scope;
}
});
} | java | public static boolean inScope(final Injector injector, final Binding<?> binding, final Class<? extends Annotation> scope) {
return binding.acceptScopingVisitor(new BindingScopingVisitor<Boolean>() {
@Override
public Boolean visitEagerSingleton() {
return scope == Singleton.class || scope == javax.inject.Singleton.class;
}
@Override
public Boolean visitNoScoping() {
return false;
}
@Override
public Boolean visitScope(Scope guiceScope) {
return injector.getScopeBindings().get(scope) == guiceScope;
}
@Override
public Boolean visitScopeAnnotation(Class<? extends Annotation> scopeAnnotation) {
return scopeAnnotation == scope;
}
});
} | [
"public",
"static",
"boolean",
"inScope",
"(",
"final",
"Injector",
"injector",
",",
"final",
"Binding",
"<",
"?",
">",
"binding",
",",
"final",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"scope",
")",
"{",
"return",
"binding",
".",
"acceptScopingVisit... | Returns true if the binding is in the specified scope, false otherwise.
@param binding the binding to inspect
@param scope the scope to look for
@return true if the binding is in the specified scope, false otherwise. | [
"Returns",
"true",
"if",
"the",
"binding",
"is",
"in",
"the",
"specified",
"scope",
"false",
"otherwise",
"."
] | train | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/util/Jsr250Utils.java#L368-L391 |
VoltDB/voltdb | src/frontend/org/voltdb/jdbc/JDBC4ClientConnection.java | JDBC4ClientConnection.executeAsync | public Future<ClientResponse> executeAsync(String procedure, Object... parameters)
throws NoConnectionsException, IOException
{
ClientImpl currentClient = this.getClient();
final JDBC4ExecutionFuture future = new JDBC4ExecutionFuture(this.defaultAsyncTimeout);
try {
currentClient.callProcedure(new TrackingCallback(this, procedure, new ProcedureCallback() {
@SuppressWarnings("unused")
final JDBC4ExecutionFuture result;
{
this.result = future;
}
@Override
public void clientCallback(ClientResponse response) throws Exception {
future.set(response);
}
}), procedure, parameters);
}
catch (NoConnectionsException e) {
this.dropClient(currentClient);
throw e;
}
return future;
} | java | public Future<ClientResponse> executeAsync(String procedure, Object... parameters)
throws NoConnectionsException, IOException
{
ClientImpl currentClient = this.getClient();
final JDBC4ExecutionFuture future = new JDBC4ExecutionFuture(this.defaultAsyncTimeout);
try {
currentClient.callProcedure(new TrackingCallback(this, procedure, new ProcedureCallback() {
@SuppressWarnings("unused")
final JDBC4ExecutionFuture result;
{
this.result = future;
}
@Override
public void clientCallback(ClientResponse response) throws Exception {
future.set(response);
}
}), procedure, parameters);
}
catch (NoConnectionsException e) {
this.dropClient(currentClient);
throw e;
}
return future;
} | [
"public",
"Future",
"<",
"ClientResponse",
">",
"executeAsync",
"(",
"String",
"procedure",
",",
"Object",
"...",
"parameters",
")",
"throws",
"NoConnectionsException",
",",
"IOException",
"{",
"ClientImpl",
"currentClient",
"=",
"this",
".",
"getClient",
"(",
")"... | Executes a procedure asynchronously, returning a Future that can be used by the caller to
wait upon completion before processing the server response.
@param procedure
the name of the procedure to call.
@param parameters
the list of parameters to pass to the procedure.
@return the Future created to wrap around the asynchronous process. | [
"Executes",
"a",
"procedure",
"asynchronously",
"returning",
"a",
"Future",
"that",
"can",
"be",
"used",
"by",
"the",
"caller",
"to",
"wait",
"upon",
"completion",
"before",
"processing",
"the",
"server",
"response",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4ClientConnection.java#L439-L463 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.serviceName_pca_pcaServiceName_billing_GET | public ArrayList<Long> serviceName_pca_pcaServiceName_billing_GET(String serviceName, String pcaServiceName, Boolean billed, Date date_from, Date date_to) throws IOException {
String qPath = "/cloud/{serviceName}/pca/{pcaServiceName}/billing";
StringBuilder sb = path(qPath, serviceName, pcaServiceName);
query(sb, "billed", billed);
query(sb, "date.from", date_from);
query(sb, "date.to", date_to);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t3);
} | java | public ArrayList<Long> serviceName_pca_pcaServiceName_billing_GET(String serviceName, String pcaServiceName, Boolean billed, Date date_from, Date date_to) throws IOException {
String qPath = "/cloud/{serviceName}/pca/{pcaServiceName}/billing";
StringBuilder sb = path(qPath, serviceName, pcaServiceName);
query(sb, "billed", billed);
query(sb, "date.from", date_from);
query(sb, "date.to", date_to);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t3);
} | [
"public",
"ArrayList",
"<",
"Long",
">",
"serviceName_pca_pcaServiceName_billing_GET",
"(",
"String",
"serviceName",
",",
"String",
"pcaServiceName",
",",
"Boolean",
"billed",
",",
"Date",
"date_from",
",",
"Date",
"date_to",
")",
"throws",
"IOException",
"{",
"Stri... | cloud Archives billing items
REST: GET /cloud/{serviceName}/pca/{pcaServiceName}/billing
@param date_to [required] Filter the value of date property (<=)
@param billed [required] Filter the value of billed property (=)
@param date_from [required] Filter the value of date property (>=)
@param serviceName [required] The internal name of your public cloud passport
@param pcaServiceName [required] The internal name of your PCA offer
@deprecated | [
"cloud",
"Archives",
"billing",
"items"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L2599-L2607 |
SvenEwald/xmlbeam | src/main/java/org/xmlbeam/evaluation/DefaultXPathEvaluator.java | DefaultXPathEvaluator.asListOf | @Override
public <T> List<T> asListOf(final Class<T> componentType) {
Class<?> callerClass = ReflectionHelper.getDirectCallerClass();
return evaluateMultiValues(componentType, callerClass);
} | java | @Override
public <T> List<T> asListOf(final Class<T> componentType) {
Class<?> callerClass = ReflectionHelper.getDirectCallerClass();
return evaluateMultiValues(componentType, callerClass);
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"List",
"<",
"T",
">",
"asListOf",
"(",
"final",
"Class",
"<",
"T",
">",
"componentType",
")",
"{",
"Class",
"<",
"?",
">",
"callerClass",
"=",
"ReflectionHelper",
".",
"getDirectCallerClass",
"(",
")",
";",
"r... | Evaluate the XPath as a list of the given type.
@param componentType
Possible values: primitive types (e.g. Short.Type), Projection interfaces, any
class with a String constructor or a String factory method, and org.w3c.Node
@return List of return type that reflects the evaluation result. | [
"Evaluate",
"the",
"XPath",
"as",
"a",
"list",
"of",
"the",
"given",
"type",
"."
] | train | https://github.com/SvenEwald/xmlbeam/blob/acaac1b8fa28d246f17187f5e3c6696458a0b447/src/main/java/org/xmlbeam/evaluation/DefaultXPathEvaluator.java#L212-L216 |
googleads/googleads-java-lib | modules/adwords_axis/src/main/java/com/google/api/ads/adwords/axis/utils/v201809/shopping/ProductPartitionTreeImpl.java | ProductPartitionTreeImpl.createNonEmptyAdGroupTree | private static ProductPartitionTreeImpl createNonEmptyAdGroupTree(Long adGroupId,
ListMultimap<Long, AdGroupCriterion> parentIdMap) {
Preconditions.checkNotNull(adGroupId, "Null ad group ID");
Preconditions.checkArgument(!parentIdMap.isEmpty(),
"parentIdMap passed for ad group ID %s is empty", adGroupId);
Preconditions.checkArgument(parentIdMap.containsKey(null),
"No root criterion found in the list of ad group criteria for ad group ID %s", adGroupId);
AdGroupCriterion rootCriterion = Iterables.getOnlyElement(parentIdMap.get(null));
Preconditions.checkState(rootCriterion instanceof BiddableAdGroupCriterion,
"Root criterion for ad group ID %s is not a BiddableAdGroupCriterion", adGroupId);
BiddableAdGroupCriterion biddableRootCriterion = (BiddableAdGroupCriterion) rootCriterion;
BiddingStrategyConfiguration biddingStrategyConfig =
biddableRootCriterion.getBiddingStrategyConfiguration();
Preconditions.checkState(biddingStrategyConfig != null,
"Null bidding strategy config on the root node of ad group ID %s", adGroupId);
ProductPartitionNode rootNode = new ProductPartitionNode(null, (ProductDimension) null,
rootCriterion.getCriterion().getId(), new ProductDimensionComparator());
// Set the root's bid if a bid exists on the BiddableAdGroupCriterion.
Money rootNodeBid = getBid(biddableRootCriterion);
if (rootNodeBid != null) {
rootNode = rootNode.asBiddableUnit().setBid(rootNodeBid.getMicroAmount());
}
rootNode = rootNode.setTrackingUrlTemplate(biddableRootCriterion.getTrackingUrlTemplate());
rootNode = copyCustomParametersToNode(biddableRootCriterion, rootNode);
addChildNodes(rootNode, parentIdMap);
return new ProductPartitionTreeImpl(adGroupId, biddingStrategyConfig, rootNode);
} | java | private static ProductPartitionTreeImpl createNonEmptyAdGroupTree(Long adGroupId,
ListMultimap<Long, AdGroupCriterion> parentIdMap) {
Preconditions.checkNotNull(adGroupId, "Null ad group ID");
Preconditions.checkArgument(!parentIdMap.isEmpty(),
"parentIdMap passed for ad group ID %s is empty", adGroupId);
Preconditions.checkArgument(parentIdMap.containsKey(null),
"No root criterion found in the list of ad group criteria for ad group ID %s", adGroupId);
AdGroupCriterion rootCriterion = Iterables.getOnlyElement(parentIdMap.get(null));
Preconditions.checkState(rootCriterion instanceof BiddableAdGroupCriterion,
"Root criterion for ad group ID %s is not a BiddableAdGroupCriterion", adGroupId);
BiddableAdGroupCriterion biddableRootCriterion = (BiddableAdGroupCriterion) rootCriterion;
BiddingStrategyConfiguration biddingStrategyConfig =
biddableRootCriterion.getBiddingStrategyConfiguration();
Preconditions.checkState(biddingStrategyConfig != null,
"Null bidding strategy config on the root node of ad group ID %s", adGroupId);
ProductPartitionNode rootNode = new ProductPartitionNode(null, (ProductDimension) null,
rootCriterion.getCriterion().getId(), new ProductDimensionComparator());
// Set the root's bid if a bid exists on the BiddableAdGroupCriterion.
Money rootNodeBid = getBid(biddableRootCriterion);
if (rootNodeBid != null) {
rootNode = rootNode.asBiddableUnit().setBid(rootNodeBid.getMicroAmount());
}
rootNode = rootNode.setTrackingUrlTemplate(biddableRootCriterion.getTrackingUrlTemplate());
rootNode = copyCustomParametersToNode(biddableRootCriterion, rootNode);
addChildNodes(rootNode, parentIdMap);
return new ProductPartitionTreeImpl(adGroupId, biddingStrategyConfig, rootNode);
} | [
"private",
"static",
"ProductPartitionTreeImpl",
"createNonEmptyAdGroupTree",
"(",
"Long",
"adGroupId",
",",
"ListMultimap",
"<",
"Long",
",",
"AdGroupCriterion",
">",
"parentIdMap",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"adGroupId",
",",
"\"Null ad group... | Returns a new tree based on a non-empty collection of ad group criteria. All parameters
required.
@param adGroupId the ID of the ad group
@param parentIdMap the multimap from parent product partition ID to child criteria
@return a new ProductPartitionTree | [
"Returns",
"a",
"new",
"tree",
"based",
"on",
"a",
"non",
"-",
"empty",
"collection",
"of",
"ad",
"group",
"criteria",
".",
"All",
"parameters",
"required",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/adwords_axis/src/main/java/com/google/api/ads/adwords/axis/utils/v201809/shopping/ProductPartitionTreeImpl.java#L286-L318 |
duracloud/duracloud | durastore/src/main/java/org/duracloud/durastore/rest/ContentRest.java | ContentRest.updateContentProperties | @POST
public Response updateContentProperties(@PathParam("spaceID") String spaceID,
@PathParam("contentID") String contentID,
@QueryParam("storeID") String storeID) {
StringBuilder msg = new StringBuilder("updating content properties(");
msg.append(spaceID);
msg.append(", ");
msg.append(contentID);
msg.append(", ");
msg.append(storeID);
msg.append(")");
try {
log.debug(msg.toString());
return doUpdateContentProperties(spaceID, contentID, storeID);
} catch (ResourceNotFoundException e) {
return responseNotFound(msg.toString(), e, NOT_FOUND);
} catch (ResourcePropertiesInvalidException e) {
return responseBad(e.getMessage(), BAD_REQUEST);
} catch (ResourceStateException e) {
return responseBad(msg.toString(), e, CONFLICT);
} catch (ResourceException e) {
return responseBad(msg.toString(), e, INTERNAL_SERVER_ERROR);
} catch (Exception e) {
return responseBad(msg.toString(), e, INTERNAL_SERVER_ERROR);
}
} | java | @POST
public Response updateContentProperties(@PathParam("spaceID") String spaceID,
@PathParam("contentID") String contentID,
@QueryParam("storeID") String storeID) {
StringBuilder msg = new StringBuilder("updating content properties(");
msg.append(spaceID);
msg.append(", ");
msg.append(contentID);
msg.append(", ");
msg.append(storeID);
msg.append(")");
try {
log.debug(msg.toString());
return doUpdateContentProperties(spaceID, contentID, storeID);
} catch (ResourceNotFoundException e) {
return responseNotFound(msg.toString(), e, NOT_FOUND);
} catch (ResourcePropertiesInvalidException e) {
return responseBad(e.getMessage(), BAD_REQUEST);
} catch (ResourceStateException e) {
return responseBad(msg.toString(), e, CONFLICT);
} catch (ResourceException e) {
return responseBad(msg.toString(), e, INTERNAL_SERVER_ERROR);
} catch (Exception e) {
return responseBad(msg.toString(), e, INTERNAL_SERVER_ERROR);
}
} | [
"@",
"POST",
"public",
"Response",
"updateContentProperties",
"(",
"@",
"PathParam",
"(",
"\"spaceID\"",
")",
"String",
"spaceID",
",",
"@",
"PathParam",
"(",
"\"contentID\"",
")",
"String",
"contentID",
",",
"@",
"QueryParam",
"(",
"\"storeID\"",
")",
"String",... | see ContentResource.updateContentProperties()
@return 200 response indicating content properties updated successfully | [
"see",
"ContentResource",
".",
"updateContentProperties",
"()"
] | train | https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/durastore/src/main/java/org/duracloud/durastore/rest/ContentRest.java#L314-L342 |
overturetool/overture | ide/ui/src/main/java/org/overture/ide/ui/internal/viewsupport/VdmElementImageProvider.java | VdmElementImageProvider.getWorkbenchImageDescriptor | public ImageDescriptor getWorkbenchImageDescriptor(IAdaptable adaptable,
int flags) {
IWorkbenchAdapter wbAdapter = (IWorkbenchAdapter) adaptable
.getAdapter(IWorkbenchAdapter.class);
if (wbAdapter == null) {
return null;
}
ImageDescriptor descriptor = wbAdapter.getImageDescriptor(adaptable);
if (descriptor == null) {
return null;
}
Point size = useSmallSize(flags) ? SMALL_SIZE : BIG_SIZE;
return new VdmElementImageDescriptor(descriptor, 0, size);
} | java | public ImageDescriptor getWorkbenchImageDescriptor(IAdaptable adaptable,
int flags) {
IWorkbenchAdapter wbAdapter = (IWorkbenchAdapter) adaptable
.getAdapter(IWorkbenchAdapter.class);
if (wbAdapter == null) {
return null;
}
ImageDescriptor descriptor = wbAdapter.getImageDescriptor(adaptable);
if (descriptor == null) {
return null;
}
Point size = useSmallSize(flags) ? SMALL_SIZE : BIG_SIZE;
return new VdmElementImageDescriptor(descriptor, 0, size);
} | [
"public",
"ImageDescriptor",
"getWorkbenchImageDescriptor",
"(",
"IAdaptable",
"adaptable",
",",
"int",
"flags",
")",
"{",
"IWorkbenchAdapter",
"wbAdapter",
"=",
"(",
"IWorkbenchAdapter",
")",
"adaptable",
".",
"getAdapter",
"(",
"IWorkbenchAdapter",
".",
"class",
")"... | Returns an image descriptor for a IAdaptable. The descriptor includes
overlays, if specified (only error ticks apply). Returns
<code>null</code> if no image could be found.
@param adaptable
the adaptable
@param flags
the image flags
@return returns the image descriptor | [
"Returns",
"an",
"image",
"descriptor",
"for",
"a",
"IAdaptable",
".",
"The",
"descriptor",
"includes",
"overlays",
"if",
"specified",
"(",
"only",
"error",
"ticks",
"apply",
")",
".",
"Returns",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"no",
"image"... | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/ui/src/main/java/org/overture/ide/ui/internal/viewsupport/VdmElementImageProvider.java#L594-L608 |
dlemmermann/CalendarFX | CalendarFXView/src/main/java/com/calendarfx/view/DateControl.java | DateControl.setEntryDetailsPopOverContentCallback | public final void setEntryDetailsPopOverContentCallback(Callback<EntryDetailsPopOverContentParameter, Node> callback) {
requireNonNull(callback);
entryDetailsPopOverContentCallbackProperty().set(callback);
} | java | public final void setEntryDetailsPopOverContentCallback(Callback<EntryDetailsPopOverContentParameter, Node> callback) {
requireNonNull(callback);
entryDetailsPopOverContentCallbackProperty().set(callback);
} | [
"public",
"final",
"void",
"setEntryDetailsPopOverContentCallback",
"(",
"Callback",
"<",
"EntryDetailsPopOverContentParameter",
",",
"Node",
">",
"callback",
")",
"{",
"requireNonNull",
"(",
"callback",
")",
";",
"entryDetailsPopOverContentCallbackProperty",
"(",
")",
".... | Sets the value of {@link #entryDetailsPopOverContentCallbackProperty()}.
@param callback the entry details popover content callback | [
"Sets",
"the",
"value",
"of",
"{",
"@link",
"#entryDetailsPopOverContentCallbackProperty",
"()",
"}",
"."
] | train | https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXView/src/main/java/com/calendarfx/view/DateControl.java#L1752-L1755 |
massfords/jaxb-visitor | src/main/java/com/massfords/jaxb/ClassDiscoverer.java | ClassDiscoverer.handleXmlElement | private static void handleXmlElement(Outline outline, Set<String> directClasses, JAnnotationValue type) {
StringWriter sw = new StringWriter();
JFormatter jf = new JFormatter(new PrintWriter(sw));
type.generate(jf);
String s = sw.toString();
s = s.substring(0, s.length()-".class".length());
if (!s.startsWith("java") && outline.getCodeModel()._getClass(s) == null && !foundWithinOutline(s, outline)) {
directClasses.add(s);
}
} | java | private static void handleXmlElement(Outline outline, Set<String> directClasses, JAnnotationValue type) {
StringWriter sw = new StringWriter();
JFormatter jf = new JFormatter(new PrintWriter(sw));
type.generate(jf);
String s = sw.toString();
s = s.substring(0, s.length()-".class".length());
if (!s.startsWith("java") && outline.getCodeModel()._getClass(s) == null && !foundWithinOutline(s, outline)) {
directClasses.add(s);
}
} | [
"private",
"static",
"void",
"handleXmlElement",
"(",
"Outline",
"outline",
",",
"Set",
"<",
"String",
">",
"directClasses",
",",
"JAnnotationValue",
"type",
")",
"{",
"StringWriter",
"sw",
"=",
"new",
"StringWriter",
"(",
")",
";",
"JFormatter",
"jf",
"=",
... | Handles the extraction of the schema type from the XmlElement
annotation. This was surprisingly difficult. Apparently the
model doesn't provide access to the annotation we're referring to
so I need to print it and read the string back. Even the formatter
itself is final!
@param outline root of the generated code
@param directClasses set of classes to append to
@param type annotation we're analysing | [
"Handles",
"the",
"extraction",
"of",
"the",
"schema",
"type",
"from",
"the",
"XmlElement",
"annotation",
".",
"This",
"was",
"surprisingly",
"difficult",
".",
"Apparently",
"the",
"model",
"doesn",
"t",
"provide",
"access",
"to",
"the",
"annotation",
"we",
"r... | train | https://github.com/massfords/jaxb-visitor/blob/0d66cd4d8b6700b5eb67c028a87b53792be895b8/src/main/java/com/massfords/jaxb/ClassDiscoverer.java#L108-L117 |
Netflix/astyanax | astyanax-recipes/src/main/java/com/netflix/astyanax/recipes/locks/ColumnPrefixDistributedRowLock.java | ColumnPrefixDistributedRowLock.verifyLock | public void verifyLock(long curTimeInMicros) throws Exception, BusyLockException, StaleLockException {
if (lockColumn == null)
throw new IllegalStateException("verifyLock() called without attempting to take the lock");
// Read back all columns. There should be only 1 if we got the lock
Map<String, Long> lockResult = readLockColumns(readDataColumns);
// Cleanup and check that we really got the lock
for (Entry<String, Long> entry : lockResult.entrySet()) {
// This is a stale lock that was never cleaned up
if (entry.getValue() != 0 && curTimeInMicros > entry.getValue()) {
if (failOnStaleLock) {
throw new StaleLockException("Stale lock on row '" + key + "'. Manual cleanup requried.");
}
locksToDelete.add(entry.getKey());
}
// Lock already taken, and not by us
else if (!entry.getKey().equals(lockColumn)) {
throw new BusyLockException("Lock already acquired for row '" + key + "' with lock column " + entry.getKey());
}
}
} | java | public void verifyLock(long curTimeInMicros) throws Exception, BusyLockException, StaleLockException {
if (lockColumn == null)
throw new IllegalStateException("verifyLock() called without attempting to take the lock");
// Read back all columns. There should be only 1 if we got the lock
Map<String, Long> lockResult = readLockColumns(readDataColumns);
// Cleanup and check that we really got the lock
for (Entry<String, Long> entry : lockResult.entrySet()) {
// This is a stale lock that was never cleaned up
if (entry.getValue() != 0 && curTimeInMicros > entry.getValue()) {
if (failOnStaleLock) {
throw new StaleLockException("Stale lock on row '" + key + "'. Manual cleanup requried.");
}
locksToDelete.add(entry.getKey());
}
// Lock already taken, and not by us
else if (!entry.getKey().equals(lockColumn)) {
throw new BusyLockException("Lock already acquired for row '" + key + "' with lock column " + entry.getKey());
}
}
} | [
"public",
"void",
"verifyLock",
"(",
"long",
"curTimeInMicros",
")",
"throws",
"Exception",
",",
"BusyLockException",
",",
"StaleLockException",
"{",
"if",
"(",
"lockColumn",
"==",
"null",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"verifyLock() called witho... | Verify that the lock was acquired. This shouldn't be called unless it's part of a recipe
built on top of ColumnPrefixDistributedRowLock.
@param curTimeInMicros
@throws BusyLockException | [
"Verify",
"that",
"the",
"lock",
"was",
"acquired",
".",
"This",
"shouldn",
"t",
"be",
"called",
"unless",
"it",
"s",
"part",
"of",
"a",
"recipe",
"built",
"on",
"top",
"of",
"ColumnPrefixDistributedRowLock",
"."
] | train | https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-recipes/src/main/java/com/netflix/astyanax/recipes/locks/ColumnPrefixDistributedRowLock.java#L282-L303 |
cdk/cdk | display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/VecmathUtil.java | VecmathUtil.adjacentLength | static double adjacentLength(Vector2d hypotenuse, Vector2d adjacent, double oppositeLength) {
return Math.tan(hypotenuse.angle(adjacent)) * oppositeLength;
} | java | static double adjacentLength(Vector2d hypotenuse, Vector2d adjacent, double oppositeLength) {
return Math.tan(hypotenuse.angle(adjacent)) * oppositeLength;
} | [
"static",
"double",
"adjacentLength",
"(",
"Vector2d",
"hypotenuse",
",",
"Vector2d",
"adjacent",
",",
"double",
"oppositeLength",
")",
"{",
"return",
"Math",
".",
"tan",
"(",
"hypotenuse",
".",
"angle",
"(",
"adjacent",
")",
")",
"*",
"oppositeLength",
";",
... | Given vectors for the hypotenuse and adjacent side of a right angled
triangle and the length of the opposite side, determine how long the
adjacent side size.
@param hypotenuse vector for the hypotenuse
@param adjacent vector for the adjacent side
@param oppositeLength length of the opposite side of a triangle
@return length of the adjacent side | [
"Given",
"vectors",
"for",
"the",
"hypotenuse",
"and",
"adjacent",
"side",
"of",
"a",
"right",
"angled",
"triangle",
"and",
"the",
"length",
"of",
"the",
"opposite",
"side",
"determine",
"how",
"long",
"the",
"adjacent",
"side",
"size",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/VecmathUtil.java#L220-L222 |
haifengl/smile | math/src/main/java/smile/math/matrix/Lanczos.java | Lanczos.ortbnd | private static void ortbnd(double[] alf, double[] bet, double[] eta, double[] oldeta, int step, double rnm, double eps) {
if (step < 1) {
return;
}
if (0 != rnm) {
if (step > 1) {
oldeta[0] = (bet[1] * eta[1] + (alf[0] - alf[step]) * eta[0] - bet[step] * oldeta[0]) / rnm + eps;
}
for (int i = 1; i <= step - 2; i++) {
oldeta[i] = (bet[i + 1] * eta[i + 1] + (alf[i] - alf[step]) * eta[i] + bet[i] * eta[i - 1] - bet[step] * oldeta[i]) / rnm + eps;
}
}
oldeta[step - 1] = eps;
for (int i = 0; i < step; i++) {
double swap = eta[i];
eta[i] = oldeta[i];
oldeta[i] = swap;
}
eta[step] = eps;
} | java | private static void ortbnd(double[] alf, double[] bet, double[] eta, double[] oldeta, int step, double rnm, double eps) {
if (step < 1) {
return;
}
if (0 != rnm) {
if (step > 1) {
oldeta[0] = (bet[1] * eta[1] + (alf[0] - alf[step]) * eta[0] - bet[step] * oldeta[0]) / rnm + eps;
}
for (int i = 1; i <= step - 2; i++) {
oldeta[i] = (bet[i + 1] * eta[i + 1] + (alf[i] - alf[step]) * eta[i] + bet[i] * eta[i - 1] - bet[step] * oldeta[i]) / rnm + eps;
}
}
oldeta[step - 1] = eps;
for (int i = 0; i < step; i++) {
double swap = eta[i];
eta[i] = oldeta[i];
oldeta[i] = swap;
}
eta[step] = eps;
} | [
"private",
"static",
"void",
"ortbnd",
"(",
"double",
"[",
"]",
"alf",
",",
"double",
"[",
"]",
"bet",
",",
"double",
"[",
"]",
"eta",
",",
"double",
"[",
"]",
"oldeta",
",",
"int",
"step",
",",
"double",
"rnm",
",",
"double",
"eps",
")",
"{",
"i... | Update the eta recurrence.
@param alf array to store diagonal of the tridiagonal matrix T
@param bet array to store off-diagonal of T
@param eta on input, orthogonality estimate of Lanczos vectors at step j.
On output, orthogonality estimate of Lanczos vectors at step j+1 .
@param oldeta on input, orthogonality estimate of Lanczos vectors at step j-1
On output orthogonality estimate of Lanczos vectors at step j
@param step dimension of T
@param rnm norm of the next residual vector
@param eps roundoff estimate for dot product of two unit vectors | [
"Update",
"the",
"eta",
"recurrence",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/matrix/Lanczos.java#L381-L404 |
marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClient.java | MarkLogicClient.sendAdd | public void sendAdd(String baseURI, Resource subject, URI predicate, Value object, Resource... contexts) throws MarkLogicSesameException {
if (WRITE_CACHE_ENABLED) {
timerWriteCache.add(subject, predicate, object, contexts);
} else {
getClient().performAdd(baseURI, (Resource) skolemize(subject), (URI) skolemize(predicate), skolemize(object), this.tx, contexts);
}
} | java | public void sendAdd(String baseURI, Resource subject, URI predicate, Value object, Resource... contexts) throws MarkLogicSesameException {
if (WRITE_CACHE_ENABLED) {
timerWriteCache.add(subject, predicate, object, contexts);
} else {
getClient().performAdd(baseURI, (Resource) skolemize(subject), (URI) skolemize(predicate), skolemize(object), this.tx, contexts);
}
} | [
"public",
"void",
"sendAdd",
"(",
"String",
"baseURI",
",",
"Resource",
"subject",
",",
"URI",
"predicate",
",",
"Value",
"object",
",",
"Resource",
"...",
"contexts",
")",
"throws",
"MarkLogicSesameException",
"{",
"if",
"(",
"WRITE_CACHE_ENABLED",
")",
"{",
... | add single triple, if cache is enabled will add triple to cache model
@param baseURI
@param subject
@param predicate
@param object
@param contexts | [
"add",
"single",
"triple",
"if",
"cache",
"is",
"enabled",
"will",
"add",
"triple",
"to",
"cache",
"model"
] | train | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClient.java#L340-L346 |
ops4j/org.ops4j.pax.wicket | service/src/main/java/org/ops4j/pax/wicket/spi/support/BundleInjectionProviderHelper.java | BundleInjectionProviderHelper.setApplicationName | public final void setApplicationName(String applicationName) {
synchronized (lock) {
if (applicationName == null) {
serviceProperties.remove(APPLICATION_NAME);
bundleAnalysingComponentInstantiationListener = null;
} else {
serviceProperties.put(APPLICATION_NAME, applicationName);
bundleAnalysingComponentInstantiationListener =
new BundleAnalysingComponentInstantiationListener(bundleContext, injectionSource, factoryTracker);
}
if (serviceRegistration != null) {
serviceRegistration.setProperties(serviceProperties);
}
}
} | java | public final void setApplicationName(String applicationName) {
synchronized (lock) {
if (applicationName == null) {
serviceProperties.remove(APPLICATION_NAME);
bundleAnalysingComponentInstantiationListener = null;
} else {
serviceProperties.put(APPLICATION_NAME, applicationName);
bundleAnalysingComponentInstantiationListener =
new BundleAnalysingComponentInstantiationListener(bundleContext, injectionSource, factoryTracker);
}
if (serviceRegistration != null) {
serviceRegistration.setProperties(serviceProperties);
}
}
} | [
"public",
"final",
"void",
"setApplicationName",
"(",
"String",
"applicationName",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"applicationName",
"==",
"null",
")",
"{",
"serviceProperties",
".",
"remove",
"(",
"APPLICATION_NAME",
")",
";",
"bu... | Sets the application nane.
@param applicationName a {@link java.lang.String} object. | [
"Sets",
"the",
"application",
"nane",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.wicket/blob/ef7cb4bdf918e9e61ec69789b9c690567616faa9/service/src/main/java/org/ops4j/pax/wicket/spi/support/BundleInjectionProviderHelper.java#L116-L131 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.deleteRelationsForResource | public void deleteRelationsForResource(CmsRequestContext context, CmsResource resource, CmsRelationFilter filter)
throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
checkOfflineProject(dbc);
checkPermissions(dbc, resource, CmsPermissionSet.ACCESS_WRITE, true, CmsResourceFilter.ALL);
m_driverManager.deleteRelationsForResource(dbc, resource, filter);
} catch (Exception e) {
dbc.report(
null,
Messages.get().container(Messages.ERR_DELETE_RELATIONS_1, dbc.removeSiteRoot(resource.getRootPath())),
e);
} finally {
dbc.clear();
}
} | java | public void deleteRelationsForResource(CmsRequestContext context, CmsResource resource, CmsRelationFilter filter)
throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
checkOfflineProject(dbc);
checkPermissions(dbc, resource, CmsPermissionSet.ACCESS_WRITE, true, CmsResourceFilter.ALL);
m_driverManager.deleteRelationsForResource(dbc, resource, filter);
} catch (Exception e) {
dbc.report(
null,
Messages.get().container(Messages.ERR_DELETE_RELATIONS_1, dbc.removeSiteRoot(resource.getRootPath())),
e);
} finally {
dbc.clear();
}
} | [
"public",
"void",
"deleteRelationsForResource",
"(",
"CmsRequestContext",
"context",
",",
"CmsResource",
"resource",
",",
"CmsRelationFilter",
"filter",
")",
"throws",
"CmsException",
"{",
"CmsDbContext",
"dbc",
"=",
"m_dbContextFactory",
".",
"getDbContext",
"(",
"cont... | Deletes all relations for the given resource matching the given filter.<p>
@param context the current user context
@param resource the resource to delete the relations for
@param filter the filter to use for deletion
@throws CmsException if something goes wrong
@see #addRelationToResource(CmsRequestContext, CmsResource, CmsResource, CmsRelationType, boolean)
@see CmsObject#deleteRelationsFromResource(String, CmsRelationFilter) | [
"Deletes",
"all",
"relations",
"for",
"the",
"given",
"resource",
"matching",
"the",
"given",
"filter",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L1543-L1559 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/view/ViewUtils.java | ViewUtils.toggleVisibility | public static void toggleVisibility(View view, int hidingPolicy) {
int current = view.getVisibility();
view.setVisibility(current == View.VISIBLE ? hidingPolicy : View.VISIBLE);
} | java | public static void toggleVisibility(View view, int hidingPolicy) {
int current = view.getVisibility();
view.setVisibility(current == View.VISIBLE ? hidingPolicy : View.VISIBLE);
} | [
"public",
"static",
"void",
"toggleVisibility",
"(",
"View",
"view",
",",
"int",
"hidingPolicy",
")",
"{",
"int",
"current",
"=",
"view",
".",
"getVisibility",
"(",
")",
";",
"view",
".",
"setVisibility",
"(",
"current",
"==",
"View",
".",
"VISIBLE",
"?",
... | Toggle visibility of a {@link android.view.View}.
Status of invisible is applied by the parameter of hidingPolicy.
@param view to toggle
@param hidingPolicy {@link android.view.View#INVISIBLE} or {@link android.view.View#GONE} | [
"Toggle",
"visibility",
"of",
"a",
"{"
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/view/ViewUtils.java#L123-L126 |
Red5/red5-server-common | src/main/java/org/red5/server/persistence/RamPersistence.java | RamPersistence.getObjectPath | protected String getObjectPath(String id, String name) {
// The format of the object id is <type>/<path>/<objectName>
id = id.substring(id.indexOf('/') + 1);
if (id.charAt(0) == '/') {
id = id.substring(1);
}
if (id.lastIndexOf(name) <= 0) {
return id;
}
return id.substring(0, id.lastIndexOf(name) - 1);
} | java | protected String getObjectPath(String id, String name) {
// The format of the object id is <type>/<path>/<objectName>
id = id.substring(id.indexOf('/') + 1);
if (id.charAt(0) == '/') {
id = id.substring(1);
}
if (id.lastIndexOf(name) <= 0) {
return id;
}
return id.substring(0, id.lastIndexOf(name) - 1);
} | [
"protected",
"String",
"getObjectPath",
"(",
"String",
"id",
",",
"String",
"name",
")",
"{",
"// The format of the object id is <type>/<path>/<objectName>\r",
"id",
"=",
"id",
".",
"substring",
"(",
"id",
".",
"indexOf",
"(",
"'",
"'",
")",
"+",
"1",
")",
";"... | Get object path for given id and name. The format of the object id is
<pre>
type / path / objectName
</pre>
@param id
object id
@param name
object name
@return resource path | [
"Get",
"object",
"path",
"for",
"given",
"id",
"and",
"name",
".",
"The",
"format",
"of",
"the",
"object",
"id",
"is"
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/persistence/RamPersistence.java#L113-L123 |
Metatavu/edelphi | edelphi/src/main/java/fi/metatavu/edelphi/pages/panel/admin/report/thesis/ThesisTimeSerieQueryReportPage.java | ThesisTimeSerieQueryReportPage.appendQueryPageComments | private void appendQueryPageComments(RequestContext requestContext, final QueryPage queryPage) {
PanelStamp panelStamp = RequestUtils.getActiveStamp(requestContext);
Map<Long, Map<String, String>> answers = getRequestAnswerMap(requestContext);
Double maxX = QueryPageUtils.getDoubleSetting(queryPage, "time_serie.maxX");
String axisXTitle = QueryPageUtils.getSetting(queryPage, "time_serie.xAxisTitle");
ReportPageCommentProcessor sorter = new TimeSerieReportPageCommentProcessor(panelStamp, queryPage, answers, maxX, axisXTitle);
appendQueryPageComments(requestContext, queryPage, sorter);
} | java | private void appendQueryPageComments(RequestContext requestContext, final QueryPage queryPage) {
PanelStamp panelStamp = RequestUtils.getActiveStamp(requestContext);
Map<Long, Map<String, String>> answers = getRequestAnswerMap(requestContext);
Double maxX = QueryPageUtils.getDoubleSetting(queryPage, "time_serie.maxX");
String axisXTitle = QueryPageUtils.getSetting(queryPage, "time_serie.xAxisTitle");
ReportPageCommentProcessor sorter = new TimeSerieReportPageCommentProcessor(panelStamp, queryPage, answers, maxX, axisXTitle);
appendQueryPageComments(requestContext, queryPage, sorter);
} | [
"private",
"void",
"appendQueryPageComments",
"(",
"RequestContext",
"requestContext",
",",
"final",
"QueryPage",
"queryPage",
")",
"{",
"PanelStamp",
"panelStamp",
"=",
"RequestUtils",
".",
"getActiveStamp",
"(",
"requestContext",
")",
";",
"Map",
"<",
"Long",
",",... | Appends query page comment to request.
@param requestContext request contract
@param queryPage query page | [
"Appends",
"query",
"page",
"comment",
"to",
"request",
"."
] | train | https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/pages/panel/admin/report/thesis/ThesisTimeSerieQueryReportPage.java#L181-L189 |
tminglei/form-binder-java | src/main/java/com/github/tminglei/bind/Mappings.java | Mappings.doublev | public static Mapping<Double> doublev(Constraint... constraints) {
return new FieldMapping(
InputMode.SINGLE,
mkSimpleConverter(s ->
isEmptyStr(s) ? 0.0d : Double.parseDouble(s)
), new MappingMeta(MAPPING_DOUBLE, Double.class)
).constraint(checking(Double::parseDouble, "error.double", true))
.constraint(constraints);
} | java | public static Mapping<Double> doublev(Constraint... constraints) {
return new FieldMapping(
InputMode.SINGLE,
mkSimpleConverter(s ->
isEmptyStr(s) ? 0.0d : Double.parseDouble(s)
), new MappingMeta(MAPPING_DOUBLE, Double.class)
).constraint(checking(Double::parseDouble, "error.double", true))
.constraint(constraints);
} | [
"public",
"static",
"Mapping",
"<",
"Double",
">",
"doublev",
"(",
"Constraint",
"...",
"constraints",
")",
"{",
"return",
"new",
"FieldMapping",
"(",
"InputMode",
".",
"SINGLE",
",",
"mkSimpleConverter",
"(",
"s",
"->",
"isEmptyStr",
"(",
"s",
")",
"?",
"... | (convert to Double) mapping
@param constraints constraints
@return new created mapping | [
"(",
"convert",
"to",
"Double",
")",
"mapping"
] | train | https://github.com/tminglei/form-binder-java/blob/4c0bd1e8f81ae56b21142bb525ee6b4deb7f92ab/src/main/java/com/github/tminglei/bind/Mappings.java#L77-L85 |
samskivert/pythagoras | src/main/java/pythagoras/d/Lines.java | Lines.relativeCCW | public static int relativeCCW (double px, double py, double x1, double y1, double x2, double y2) {
// A = (x2-x1, y2-y1)
// P = (px-x1, py-y1)
x2 -= x1;
y2 -= y1;
px -= x1;
py -= y1;
double t = px * y2 - py * x2; // PxA
if (t == 0f) {
t = px * x2 + py * y2; // P*A
if (t > 0f) {
px -= x2; // B-A
py -= y2;
t = px * x2 + py * y2; // (P-A)*A
if (t < 0f) {
t = 0f;
}
}
}
return (t < 0f) ? -1 : (t > 0f ? 1 : 0);
} | java | public static int relativeCCW (double px, double py, double x1, double y1, double x2, double y2) {
// A = (x2-x1, y2-y1)
// P = (px-x1, py-y1)
x2 -= x1;
y2 -= y1;
px -= x1;
py -= y1;
double t = px * y2 - py * x2; // PxA
if (t == 0f) {
t = px * x2 + py * y2; // P*A
if (t > 0f) {
px -= x2; // B-A
py -= y2;
t = px * x2 + py * y2; // (P-A)*A
if (t < 0f) {
t = 0f;
}
}
}
return (t < 0f) ? -1 : (t > 0f ? 1 : 0);
} | [
"public",
"static",
"int",
"relativeCCW",
"(",
"double",
"px",
",",
"double",
"py",
",",
"double",
"x1",
",",
"double",
"y1",
",",
"double",
"x2",
",",
"double",
"y2",
")",
"{",
"// A = (x2-x1, y2-y1)",
"// P = (px-x1, py-y1)",
"x2",
"-=",
"x1",
";",
"y2",... | Returns an indicator of where the specified point (px,py) lies with respect to the line
segment from (x1,y1) to (x2,y2).
See http://download.oracle.com/javase/6/docs/api/java/awt/geom/Line2D.html | [
"Returns",
"an",
"indicator",
"of",
"where",
"the",
"specified",
"point",
"(",
"px",
"py",
")",
"lies",
"with",
"respect",
"to",
"the",
"line",
"segment",
"from",
"(",
"x1",
"y1",
")",
"to",
"(",
"x2",
"y2",
")",
"."
] | train | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Lines.java#L131-L151 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/extension/related/RelatedTablesCoreExtension.java | RelatedTablesCoreExtension.addRelationship | public ExtendedRelation addRelationship(String baseTableName,
UserTable<? extends UserColumn> relatedTable, String relationName,
UserMappingTable userMappingTable) {
// Create the related table if needed
createRelatedTable(relatedTable);
return addRelationship(baseTableName, relatedTable.getTableName(),
userMappingTable, relationName);
} | java | public ExtendedRelation addRelationship(String baseTableName,
UserTable<? extends UserColumn> relatedTable, String relationName,
UserMappingTable userMappingTable) {
// Create the related table if needed
createRelatedTable(relatedTable);
return addRelationship(baseTableName, relatedTable.getTableName(),
userMappingTable, relationName);
} | [
"public",
"ExtendedRelation",
"addRelationship",
"(",
"String",
"baseTableName",
",",
"UserTable",
"<",
"?",
"extends",
"UserColumn",
">",
"relatedTable",
",",
"String",
"relationName",
",",
"UserMappingTable",
"userMappingTable",
")",
"{",
"// Create the related table if... | Adds a relationship between the base and user related table. Creates the
user mapping table and related table if needed.
@param baseTableName
base table name
@param relatedTable
user related table
@param relationName
relation name
@param userMappingTable
user mapping table
@return The relationship that was added
@since 3.2.0 | [
"Adds",
"a",
"relationship",
"between",
"the",
"base",
"and",
"user",
"related",
"table",
".",
"Creates",
"the",
"user",
"mapping",
"table",
"and",
"related",
"table",
"if",
"needed",
"."
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/related/RelatedTablesCoreExtension.java#L465-L474 |
otto-de/edison-microservice | edison-core/src/main/java/de/otto/edison/status/configuration/VersionInfoProperties.java | VersionInfoProperties.versionInfoProperties | public static VersionInfoProperties versionInfoProperties(final String version, final String commit, final String urlTemplate) {
final VersionInfoProperties p = new VersionInfoProperties();
p.version = version;
p.commit = commit;
p.urlTemplate = urlTemplate;
return p;
} | java | public static VersionInfoProperties versionInfoProperties(final String version, final String commit, final String urlTemplate) {
final VersionInfoProperties p = new VersionInfoProperties();
p.version = version;
p.commit = commit;
p.urlTemplate = urlTemplate;
return p;
} | [
"public",
"static",
"VersionInfoProperties",
"versionInfoProperties",
"(",
"final",
"String",
"version",
",",
"final",
"String",
"commit",
",",
"final",
"String",
"urlTemplate",
")",
"{",
"final",
"VersionInfoProperties",
"p",
"=",
"new",
"VersionInfoProperties",
"(",... | Used for testing purposes.
@param version vcs version
@param commit vcs commit number
@param urlTemplate template used to generate links to the vcs server
@return VersionInfoProperties | [
"Used",
"for",
"testing",
"purposes",
"."
] | train | https://github.com/otto-de/edison-microservice/blob/89ecf0a0dee40977f004370b0b474a36c699e8a2/edison-core/src/main/java/de/otto/edison/status/configuration/VersionInfoProperties.java#L42-L48 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/EncodingInfo.java | EncodingInfo.inEncoding | private static boolean inEncoding(char high, char low, String encoding) {
boolean isInEncoding;
try {
char cArray[] = new char[2];
cArray[0] = high;
cArray[1] = low;
// Construct a String from the char
String s = new String(cArray);
// Encode the String into a sequence of bytes
// using the given, named charset.
byte[] bArray = s.getBytes(encoding);
isInEncoding = inEncoding(high,bArray);
} catch (Exception e) {
isInEncoding = false;
}
return isInEncoding;
} | java | private static boolean inEncoding(char high, char low, String encoding) {
boolean isInEncoding;
try {
char cArray[] = new char[2];
cArray[0] = high;
cArray[1] = low;
// Construct a String from the char
String s = new String(cArray);
// Encode the String into a sequence of bytes
// using the given, named charset.
byte[] bArray = s.getBytes(encoding);
isInEncoding = inEncoding(high,bArray);
} catch (Exception e) {
isInEncoding = false;
}
return isInEncoding;
} | [
"private",
"static",
"boolean",
"inEncoding",
"(",
"char",
"high",
",",
"char",
"low",
",",
"String",
"encoding",
")",
"{",
"boolean",
"isInEncoding",
";",
"try",
"{",
"char",
"cArray",
"[",
"]",
"=",
"new",
"char",
"[",
"2",
"]",
";",
"cArray",
"[",
... | This is heart of the code that determines if a given high/low
surrogate pair forms a character that is in the given encoding.
This method is probably expensive, and the answer should be cached.
<p>
This method is not a public API,
and should only be used internally within the serializer.
@param high the high char of
a high/low surrogate pair.
@param low the low char of a high/low surrogate pair.
@param encoding the Java name of the encoding.
@xsl.usage internal | [
"This",
"is",
"heart",
"of",
"the",
"code",
"that",
"determines",
"if",
"a",
"given",
"high",
"/",
"low",
"surrogate",
"pair",
"forms",
"a",
"character",
"that",
"is",
"in",
"the",
"given",
"encoding",
".",
"This",
"method",
"is",
"probably",
"expensive",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/EncodingInfo.java#L464-L481 |
marklogic/java-client-api | marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java | StructuredQueryBuilder.temporalLsqtQuery | public StructuredQueryDefinition temporalLsqtQuery(String temporalCollection, Calendar time,
double weight, String... options)
{
if ( temporalCollection == null ) throw new IllegalArgumentException("temporalCollection cannot be null");
return new TemporalLsqtQuery(temporalCollection, DatatypeConverter.printDateTime(time), weight, options);
} | java | public StructuredQueryDefinition temporalLsqtQuery(String temporalCollection, Calendar time,
double weight, String... options)
{
if ( temporalCollection == null ) throw new IllegalArgumentException("temporalCollection cannot be null");
return new TemporalLsqtQuery(temporalCollection, DatatypeConverter.printDateTime(time), weight, options);
} | [
"public",
"StructuredQueryDefinition",
"temporalLsqtQuery",
"(",
"String",
"temporalCollection",
",",
"Calendar",
"time",
",",
"double",
"weight",
",",
"String",
"...",
"options",
")",
"{",
"if",
"(",
"temporalCollection",
"==",
"null",
")",
"throw",
"new",
"Illeg... | Matches documents with LSQT prior to timestamp
@param temporalCollection the temporal collection to query
@param time documents with lsqt equal to or prior to this timestamp will match
@param weight the weight for this query
@param options string options from the list for
<a href="http://docs.marklogic.com/cts:lsqt-query">cts:lsqt-query calls</a>
@return a query to filter by lsqt
@see <a href="http://docs.marklogic.com/cts:lsqt-query">cts:lsqt-query</a>
@see <a href="http://docs.marklogic.com/guide/search-dev/structured-query#id_85930">
Structured Queries: lsqt-query</a> | [
"Matches",
"documents",
"with",
"LSQT",
"prior",
"to",
"timestamp"
] | train | https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java#L2846-L2851 |
Labs64/swid-generator | src/main/java/com/labs64/utils/swid/processor/DefaultSwidProcessor.java | DefaultSwidProcessor.setSoftwareCreator | public DefaultSwidProcessor setSoftwareCreator(final String softwareCreatorName, final String softwareCreatorRegId) {
swidTag.setSoftwareCreator(
new EntityComplexType(
new Token(softwareCreatorName, idGenerator.nextId()),
new RegistrationId(softwareCreatorRegId, idGenerator.nextId()),
idGenerator.nextId()));
return this;
} | java | public DefaultSwidProcessor setSoftwareCreator(final String softwareCreatorName, final String softwareCreatorRegId) {
swidTag.setSoftwareCreator(
new EntityComplexType(
new Token(softwareCreatorName, idGenerator.nextId()),
new RegistrationId(softwareCreatorRegId, idGenerator.nextId()),
idGenerator.nextId()));
return this;
} | [
"public",
"DefaultSwidProcessor",
"setSoftwareCreator",
"(",
"final",
"String",
"softwareCreatorName",
",",
"final",
"String",
"softwareCreatorRegId",
")",
"{",
"swidTag",
".",
"setSoftwareCreator",
"(",
"new",
"EntityComplexType",
"(",
"new",
"Token",
"(",
"softwareCre... | Identifies the creator of the software (tag: software_creator).
@param softwareCreatorName
software creator name
@param softwareCreatorRegId
software creator registration ID
@return a reference to this object. | [
"Identifies",
"the",
"creator",
"of",
"the",
"software",
"(",
"tag",
":",
"software_creator",
")",
"."
] | train | https://github.com/Labs64/swid-generator/blob/cf78d2469469a09701bce7c5f966ac6de2b7c613/src/main/java/com/labs64/utils/swid/processor/DefaultSwidProcessor.java#L137-L144 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/ImageViewWidget.java | ImageViewWidget.setImage | public void setImage(Resource resource)
{
ImageIcon image = null;
if (resource != null && resource.exists())
{
try
{
image = new ImageIcon(resource.getURL());
}
catch (IOException e)
{
logger.warn("Error reading resource: " + resource);
throw new RuntimeException("Error reading resource " + resource, e);
}
}
setImage(image);
} | java | public void setImage(Resource resource)
{
ImageIcon image = null;
if (resource != null && resource.exists())
{
try
{
image = new ImageIcon(resource.getURL());
}
catch (IOException e)
{
logger.warn("Error reading resource: " + resource);
throw new RuntimeException("Error reading resource " + resource, e);
}
}
setImage(image);
} | [
"public",
"void",
"setImage",
"(",
"Resource",
"resource",
")",
"{",
"ImageIcon",
"image",
"=",
"null",
";",
"if",
"(",
"resource",
"!=",
"null",
"&&",
"resource",
".",
"exists",
"(",
")",
")",
"{",
"try",
"{",
"image",
"=",
"new",
"ImageIcon",
"(",
... | Sets the image content of the widget based on a resource
@param resource
points to a image resource | [
"Sets",
"the",
"image",
"content",
"of",
"the",
"widget",
"based",
"on",
"a",
"resource"
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/ImageViewWidget.java#L66-L82 |
airbnb/lottie-android | lottie/src/main/java/com/airbnb/lottie/LottieCompositionFactory.java | LottieCompositionFactory.fromAsset | public static LottieTask<LottieComposition> fromAsset(Context context, final String fileName) {
// Prevent accidentally leaking an Activity.
final Context appContext = context.getApplicationContext();
return cache(fileName, new Callable<LottieResult<LottieComposition>>() {
@Override public LottieResult<LottieComposition> call() {
return fromAssetSync(appContext, fileName);
}
});
} | java | public static LottieTask<LottieComposition> fromAsset(Context context, final String fileName) {
// Prevent accidentally leaking an Activity.
final Context appContext = context.getApplicationContext();
return cache(fileName, new Callable<LottieResult<LottieComposition>>() {
@Override public LottieResult<LottieComposition> call() {
return fromAssetSync(appContext, fileName);
}
});
} | [
"public",
"static",
"LottieTask",
"<",
"LottieComposition",
">",
"fromAsset",
"(",
"Context",
"context",
",",
"final",
"String",
"fileName",
")",
"{",
"// Prevent accidentally leaking an Activity.",
"final",
"Context",
"appContext",
"=",
"context",
".",
"getApplicationC... | Parse an animation from src/main/assets. It is recommended to use {@link #fromRawRes(Context, int)} instead.
The asset file name will be used as a cache key so future usages won't have to parse the json again.
However, if your animation has images, you may package the json and images as a single flattened zip file in assets.
@see #fromZipStream(ZipInputStream, String) | [
"Parse",
"an",
"animation",
"from",
"src",
"/",
"main",
"/",
"assets",
".",
"It",
"is",
"recommended",
"to",
"use",
"{",
"@link",
"#fromRawRes",
"(",
"Context",
"int",
")",
"}",
"instead",
".",
"The",
"asset",
"file",
"name",
"will",
"be",
"used",
"as"... | train | https://github.com/airbnb/lottie-android/blob/126dabdc9f586c87822f85fe1128cdad439d30fa/lottie/src/main/java/com/airbnb/lottie/LottieCompositionFactory.java#L89-L97 |
segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/internal/Utils.java | Utils.getSegmentSharedPreferences | public static SharedPreferences getSegmentSharedPreferences(Context context, String tag) {
return context.getSharedPreferences("analytics-android-" + tag, MODE_PRIVATE);
} | java | public static SharedPreferences getSegmentSharedPreferences(Context context, String tag) {
return context.getSharedPreferences("analytics-android-" + tag, MODE_PRIVATE);
} | [
"public",
"static",
"SharedPreferences",
"getSegmentSharedPreferences",
"(",
"Context",
"context",
",",
"String",
"tag",
")",
"{",
"return",
"context",
".",
"getSharedPreferences",
"(",
"\"analytics-android-\"",
"+",
"tag",
",",
"MODE_PRIVATE",
")",
";",
"}"
] | Returns a shared preferences for storing any library preferences. | [
"Returns",
"a",
"shared",
"preferences",
"for",
"storing",
"any",
"library",
"preferences",
"."
] | train | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/internal/Utils.java#L284-L286 |
fommil/matrix-toolkits-java | src/main/java/no/uib/cipr/matrix/io/MatrixVectorReader.java | MatrixVectorReader.readCoordinate | public void readCoordinate(int[] index, float[] dataR, float[] dataI)
throws IOException {
int size = index.length;
if (size != dataR.length || size != dataI.length)
throw new IllegalArgumentException(
"All arrays must be of the same size");
for (int i = 0; i < size; ++i) {
index[i] = getInt();
dataR[i] = getFloat();
dataI[i] = getFloat();
}
} | java | public void readCoordinate(int[] index, float[] dataR, float[] dataI)
throws IOException {
int size = index.length;
if (size != dataR.length || size != dataI.length)
throw new IllegalArgumentException(
"All arrays must be of the same size");
for (int i = 0; i < size; ++i) {
index[i] = getInt();
dataR[i] = getFloat();
dataI[i] = getFloat();
}
} | [
"public",
"void",
"readCoordinate",
"(",
"int",
"[",
"]",
"index",
",",
"float",
"[",
"]",
"dataR",
",",
"float",
"[",
"]",
"dataI",
")",
"throws",
"IOException",
"{",
"int",
"size",
"=",
"index",
".",
"length",
";",
"if",
"(",
"size",
"!=",
"dataR",... | Reads a coordinate vector. First data array contains real entries, and
the second contains imaginary entries | [
"Reads",
"a",
"coordinate",
"vector",
".",
"First",
"data",
"array",
"contains",
"real",
"entries",
"and",
"the",
"second",
"contains",
"imaginary",
"entries"
] | train | https://github.com/fommil/matrix-toolkits-java/blob/6157618bc86bcda3749af2a60bf869d8f3292960/src/main/java/no/uib/cipr/matrix/io/MatrixVectorReader.java#L450-L461 |
elki-project/elki | elki-gui-minigui/src/main/java/de/lmu/ifi/dbs/elki/gui/util/LogPanel.java | LogPanel.getOrCreateProgressBar | private JProgressBar getOrCreateProgressBar(Progress prog) {
JProgressBar pbar = pbarmap.get(prog);
// Add a new progress bar.
if(pbar == null) {
synchronized(pbarmap) {
if(prog instanceof FiniteProgress) {
pbar = new JProgressBar(0, ((FiniteProgress) prog).getTotal());
pbar.setStringPainted(true);
}
else if(prog instanceof IndefiniteProgress) {
pbar = new JProgressBar();
pbar.setIndeterminate(true);
pbar.setStringPainted(true);
}
else if(prog instanceof MutableProgress) {
pbar = new JProgressBar(0, ((MutableProgress) prog).getTotal());
pbar.setStringPainted(true);
}
else {
throw new RuntimeException("Unsupported progress record");
}
pbarmap.put(prog, pbar);
final JProgressBar pbar2 = pbar; // Make final
SwingUtilities.invokeLater(() -> addProgressBar(pbar2));
}
}
return pbar;
} | java | private JProgressBar getOrCreateProgressBar(Progress prog) {
JProgressBar pbar = pbarmap.get(prog);
// Add a new progress bar.
if(pbar == null) {
synchronized(pbarmap) {
if(prog instanceof FiniteProgress) {
pbar = new JProgressBar(0, ((FiniteProgress) prog).getTotal());
pbar.setStringPainted(true);
}
else if(prog instanceof IndefiniteProgress) {
pbar = new JProgressBar();
pbar.setIndeterminate(true);
pbar.setStringPainted(true);
}
else if(prog instanceof MutableProgress) {
pbar = new JProgressBar(0, ((MutableProgress) prog).getTotal());
pbar.setStringPainted(true);
}
else {
throw new RuntimeException("Unsupported progress record");
}
pbarmap.put(prog, pbar);
final JProgressBar pbar2 = pbar; // Make final
SwingUtilities.invokeLater(() -> addProgressBar(pbar2));
}
}
return pbar;
} | [
"private",
"JProgressBar",
"getOrCreateProgressBar",
"(",
"Progress",
"prog",
")",
"{",
"JProgressBar",
"pbar",
"=",
"pbarmap",
".",
"get",
"(",
"prog",
")",
";",
"// Add a new progress bar.",
"if",
"(",
"pbar",
"==",
"null",
")",
"{",
"synchronized",
"(",
"pb... | Get an existing or create a new progress bar.
@param prog Progress
@return Associated progress bar. | [
"Get",
"an",
"existing",
"or",
"create",
"a",
"new",
"progress",
"bar",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-gui-minigui/src/main/java/de/lmu/ifi/dbs/elki/gui/util/LogPanel.java#L132-L159 |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClient.java | SnowflakeAzureClient.getObjectMetadata | @Override
public StorageObjectMetadata getObjectMetadata(String remoteStorageLocation, String prefix)
throws StorageProviderException
{
AzureObjectMetadata azureObjectMetadata = null;
try
{
// Get a reference to the BLOB, to retrieve its metadata
CloudBlobContainer container = azStorageClient.getContainerReference(remoteStorageLocation);
CloudBlob blob = container.getBlockBlobReference(prefix);
blob.downloadAttributes();
// Get the user-defined BLOB metadata
Map<String, String> userDefinedMetadata = blob.getMetadata();
// Get the BLOB system properties we care about
BlobProperties properties = blob.getProperties();
long contentLength = properties.getLength();
String contentEncoding = properties.getContentEncoding();
// Construct an Azure metadata object
azureObjectMetadata = new AzureObjectMetadata(contentLength, contentEncoding, userDefinedMetadata);
}
catch (StorageException ex)
{
logger.debug("Failed to retrieve BLOB metadata: {} - {}", ex.getErrorCode(),
ex.getExtendedErrorInformation());
throw new StorageProviderException(ex);
}
catch (URISyntaxException ex)
{
logger.debug("Cannot retrieve BLOB properties, invalid URI: {}", ex);
throw new StorageProviderException(ex);
}
return azureObjectMetadata;
} | java | @Override
public StorageObjectMetadata getObjectMetadata(String remoteStorageLocation, String prefix)
throws StorageProviderException
{
AzureObjectMetadata azureObjectMetadata = null;
try
{
// Get a reference to the BLOB, to retrieve its metadata
CloudBlobContainer container = azStorageClient.getContainerReference(remoteStorageLocation);
CloudBlob blob = container.getBlockBlobReference(prefix);
blob.downloadAttributes();
// Get the user-defined BLOB metadata
Map<String, String> userDefinedMetadata = blob.getMetadata();
// Get the BLOB system properties we care about
BlobProperties properties = blob.getProperties();
long contentLength = properties.getLength();
String contentEncoding = properties.getContentEncoding();
// Construct an Azure metadata object
azureObjectMetadata = new AzureObjectMetadata(contentLength, contentEncoding, userDefinedMetadata);
}
catch (StorageException ex)
{
logger.debug("Failed to retrieve BLOB metadata: {} - {}", ex.getErrorCode(),
ex.getExtendedErrorInformation());
throw new StorageProviderException(ex);
}
catch (URISyntaxException ex)
{
logger.debug("Cannot retrieve BLOB properties, invalid URI: {}", ex);
throw new StorageProviderException(ex);
}
return azureObjectMetadata;
} | [
"@",
"Override",
"public",
"StorageObjectMetadata",
"getObjectMetadata",
"(",
"String",
"remoteStorageLocation",
",",
"String",
"prefix",
")",
"throws",
"StorageProviderException",
"{",
"AzureObjectMetadata",
"azureObjectMetadata",
"=",
"null",
";",
"try",
"{",
"// Get a ... | Returns the metadata properties for a remote storage object
@param remoteStorageLocation location, i.e. bucket for S3
@param prefix the prefix/path of the object to retrieve
@return storage metadata object
@throws StorageProviderException azure storage exception | [
"Returns",
"the",
"metadata",
"properties",
"for",
"a",
"remote",
"storage",
"object"
] | train | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClient.java#L259-L295 |
sksamuel/scrimage | scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java | AwtImage.toNewBufferedImage | public BufferedImage toNewBufferedImage(int type) {
BufferedImage target = new BufferedImage(width, height, type);
Graphics2D g2 = (Graphics2D) target.getGraphics();
g2.drawImage(awt, 0, 0, null);
g2.dispose();
return target;
} | java | public BufferedImage toNewBufferedImage(int type) {
BufferedImage target = new BufferedImage(width, height, type);
Graphics2D g2 = (Graphics2D) target.getGraphics();
g2.drawImage(awt, 0, 0, null);
g2.dispose();
return target;
} | [
"public",
"BufferedImage",
"toNewBufferedImage",
"(",
"int",
"type",
")",
"{",
"BufferedImage",
"target",
"=",
"new",
"BufferedImage",
"(",
"width",
",",
"height",
",",
"type",
")",
";",
"Graphics2D",
"g2",
"=",
"(",
"Graphics2D",
")",
"target",
".",
"getGra... | Returns a new AWT BufferedImage from this image.
@param type the type of buffered image to create, if not specified then defaults to the current image type
@return a new, non-shared, BufferedImage with the same data as this Image. | [
"Returns",
"a",
"new",
"AWT",
"BufferedImage",
"from",
"this",
"image",
"."
] | train | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java#L366-L372 |
apache/incubator-atlas | client/src/main/java/org/apache/atlas/AtlasClient.java | AtlasClient.getEntityAuditEvents | public List<EntityAuditEvent> getEntityAuditEvents(String entityId, String startKey, short numResults)
throws AtlasServiceException {
WebResource resource = getResource(API.LIST_ENTITY_AUDIT, entityId, URI_ENTITY_AUDIT);
if (StringUtils.isNotEmpty(startKey)) {
resource = resource.queryParam(START_KEY, startKey);
}
resource = resource.queryParam(NUM_RESULTS, String.valueOf(numResults));
JSONObject jsonResponse = callAPIWithResource(API.LIST_ENTITY_AUDIT, resource);
return extractResults(jsonResponse, AtlasClient.EVENTS, new ExtractOperation<EntityAuditEvent, JSONObject>() {
@Override
EntityAuditEvent extractElement(JSONObject element) throws JSONException {
return SerDe.GSON.fromJson(element.toString(), EntityAuditEvent.class);
}
});
} | java | public List<EntityAuditEvent> getEntityAuditEvents(String entityId, String startKey, short numResults)
throws AtlasServiceException {
WebResource resource = getResource(API.LIST_ENTITY_AUDIT, entityId, URI_ENTITY_AUDIT);
if (StringUtils.isNotEmpty(startKey)) {
resource = resource.queryParam(START_KEY, startKey);
}
resource = resource.queryParam(NUM_RESULTS, String.valueOf(numResults));
JSONObject jsonResponse = callAPIWithResource(API.LIST_ENTITY_AUDIT, resource);
return extractResults(jsonResponse, AtlasClient.EVENTS, new ExtractOperation<EntityAuditEvent, JSONObject>() {
@Override
EntityAuditEvent extractElement(JSONObject element) throws JSONException {
return SerDe.GSON.fromJson(element.toString(), EntityAuditEvent.class);
}
});
} | [
"public",
"List",
"<",
"EntityAuditEvent",
">",
"getEntityAuditEvents",
"(",
"String",
"entityId",
",",
"String",
"startKey",
",",
"short",
"numResults",
")",
"throws",
"AtlasServiceException",
"{",
"WebResource",
"resource",
"=",
"getResource",
"(",
"API",
".",
"... | Get the entity audit events in decreasing order of timestamp for the given entity id
@param entityId entity id
@param startKey key for the first event to be returned, used for pagination
@param numResults number of results to be returned
@return list of audit events for the entity id
@throws AtlasServiceException | [
"Get",
"the",
"entity",
"audit",
"events",
"in",
"decreasing",
"order",
"of",
"timestamp",
"for",
"the",
"given",
"entity",
"id"
] | train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/client/src/main/java/org/apache/atlas/AtlasClient.java#L787-L803 |
geomajas/geomajas-project-client-gwt2 | server-extension/src/main/java/org/geomajas/gwt2/client/controller/FeatureSelectionController.java | FeatureSelectionController.pixelsToUnits | private double pixelsToUnits(int pixels) {
Coordinate c1 = mapPresenter.getViewPort().getTransformationService()
.transform(new Coordinate(0, 0), RenderSpace.SCREEN, RenderSpace.WORLD);
Coordinate c2 = mapPresenter.getViewPort().getTransformationService()
.transform(new Coordinate(pixels, 0), RenderSpace.SCREEN, RenderSpace.WORLD);
return MathService.distance(c1, c2);
} | java | private double pixelsToUnits(int pixels) {
Coordinate c1 = mapPresenter.getViewPort().getTransformationService()
.transform(new Coordinate(0, 0), RenderSpace.SCREEN, RenderSpace.WORLD);
Coordinate c2 = mapPresenter.getViewPort().getTransformationService()
.transform(new Coordinate(pixels, 0), RenderSpace.SCREEN, RenderSpace.WORLD);
return MathService.distance(c1, c2);
} | [
"private",
"double",
"pixelsToUnits",
"(",
"int",
"pixels",
")",
"{",
"Coordinate",
"c1",
"=",
"mapPresenter",
".",
"getViewPort",
"(",
")",
".",
"getTransformationService",
"(",
")",
".",
"transform",
"(",
"new",
"Coordinate",
"(",
"0",
",",
"0",
")",
","... | Transform a pixel-length into a real-life distance expressed in map CRS. This depends on the current map scale.
@param pixels
The number of pixels to calculate the distance for.
@return The distance the given number of pixels entails. | [
"Transform",
"a",
"pixel",
"-",
"length",
"into",
"a",
"real",
"-",
"life",
"distance",
"expressed",
"in",
"map",
"CRS",
".",
"This",
"depends",
"on",
"the",
"current",
"map",
"scale",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/server-extension/src/main/java/org/geomajas/gwt2/client/controller/FeatureSelectionController.java#L293-L299 |
hellosign/hellosign-java-sdk | src/main/java/com/hellosign/sdk/resource/support/WhiteLabelingOptions.java | WhiteLabelingOptions.setColor | private void setColor(String key, String color) throws HelloSignException {
if (!validateColor(color)) {
throw new HelloSignException("Invalid color: " + color);
}
set(key, color);
} | java | private void setColor(String key, String color) throws HelloSignException {
if (!validateColor(color)) {
throw new HelloSignException("Invalid color: " + color);
}
set(key, color);
} | [
"private",
"void",
"setColor",
"(",
"String",
"key",
",",
"String",
"color",
")",
"throws",
"HelloSignException",
"{",
"if",
"(",
"!",
"validateColor",
"(",
"color",
")",
")",
"{",
"throw",
"new",
"HelloSignException",
"(",
"\"Invalid color: \"",
"+",
"color",... | Helper method to validate and set a color.
@param key String key
@param color String color hex code
@throws HelloSignException thrown if the color string is an invalid hex
string | [
"Helper",
"method",
"to",
"validate",
"and",
"set",
"a",
"color",
"."
] | train | https://github.com/hellosign/hellosign-java-sdk/blob/08fa7aeb3b0c68ddb6c7ea797d114d55d36d36b1/src/main/java/com/hellosign/sdk/resource/support/WhiteLabelingOptions.java#L90-L95 |
mikepenz/Crossfader | library/src/main/java/com/mikepenz/crossfader/util/UIUtils.java | UIUtils.isPointInsideView | public static boolean isPointInsideView(float x, float y, View view) {
int location[] = new int[2];
view.getLocationOnScreen(location);
int viewX = location[0];
int viewY = location[1];
//point is inside view bounds
if ((viewX < x && x < (viewX + view.getWidth())) &&
(viewY < y && y < (viewY + view.getHeight()))) {
return true;
} else {
return false;
}
} | java | public static boolean isPointInsideView(float x, float y, View view) {
int location[] = new int[2];
view.getLocationOnScreen(location);
int viewX = location[0];
int viewY = location[1];
//point is inside view bounds
if ((viewX < x && x < (viewX + view.getWidth())) &&
(viewY < y && y < (viewY + view.getHeight()))) {
return true;
} else {
return false;
}
} | [
"public",
"static",
"boolean",
"isPointInsideView",
"(",
"float",
"x",
",",
"float",
"y",
",",
"View",
"view",
")",
"{",
"int",
"location",
"[",
"]",
"=",
"new",
"int",
"[",
"2",
"]",
";",
"view",
".",
"getLocationOnScreen",
"(",
"location",
")",
";",
... | Determines if given points are inside view
@param x - x coordinate of point
@param y - y coordinate of point
@param view - view object to compare
@return true if the points are within view bounds, false otherwise | [
"Determines",
"if",
"given",
"points",
"are",
"inside",
"view"
] | train | https://github.com/mikepenz/Crossfader/blob/b2e1ee461bc3bcdd897d83f0fad950663bdc73b4/library/src/main/java/com/mikepenz/crossfader/util/UIUtils.java#L50-L63 |
matomo-org/piwik-java-tracker | src/main/java/org/piwik/java/tracking/PiwikTracker.java | PiwikTracker.sendBulkRequest | public HttpResponse sendBulkRequest(Iterable<PiwikRequest> requests, String authToken) throws IOException{
if (authToken != null && authToken.length() != PiwikRequest.AUTH_TOKEN_LENGTH){
throw new IllegalArgumentException(authToken+" is not "+PiwikRequest.AUTH_TOKEN_LENGTH+" characters long.");
}
JsonObjectBuilder ob = Json.createObjectBuilder();
JsonArrayBuilder ab = Json.createArrayBuilder();
for (PiwikRequest request : requests){
ab.add("?"+request.getQueryString());
}
ob.add(REQUESTS, ab);
if (authToken != null){
ob.add(AUTH_TOKEN, authToken);
}
HttpClient client = getHttpClient();
HttpPost post = new HttpPost(uriBuilder.build());
post.setEntity(new StringEntity(ob.build().toString(),
ContentType.APPLICATION_JSON));
try {
return client.execute(post);
} finally {
post.releaseConnection();
}
} | java | public HttpResponse sendBulkRequest(Iterable<PiwikRequest> requests, String authToken) throws IOException{
if (authToken != null && authToken.length() != PiwikRequest.AUTH_TOKEN_LENGTH){
throw new IllegalArgumentException(authToken+" is not "+PiwikRequest.AUTH_TOKEN_LENGTH+" characters long.");
}
JsonObjectBuilder ob = Json.createObjectBuilder();
JsonArrayBuilder ab = Json.createArrayBuilder();
for (PiwikRequest request : requests){
ab.add("?"+request.getQueryString());
}
ob.add(REQUESTS, ab);
if (authToken != null){
ob.add(AUTH_TOKEN, authToken);
}
HttpClient client = getHttpClient();
HttpPost post = new HttpPost(uriBuilder.build());
post.setEntity(new StringEntity(ob.build().toString(),
ContentType.APPLICATION_JSON));
try {
return client.execute(post);
} finally {
post.releaseConnection();
}
} | [
"public",
"HttpResponse",
"sendBulkRequest",
"(",
"Iterable",
"<",
"PiwikRequest",
">",
"requests",
",",
"String",
"authToken",
")",
"throws",
"IOException",
"{",
"if",
"(",
"authToken",
"!=",
"null",
"&&",
"authToken",
".",
"length",
"(",
")",
"!=",
"PiwikReq... | Send multiple requests in a single HTTP call. More efficient than sending
several individual requests. Specify the AuthToken if parameters that require
an auth token is used.
@param requests the requests to send
@param authToken specify if any of the parameters use require AuthToken
@return the response from these requests
@throws IOException thrown if there was a problem with this connection | [
"Send",
"multiple",
"requests",
"in",
"a",
"single",
"HTTP",
"call",
".",
"More",
"efficient",
"than",
"sending",
"several",
"individual",
"requests",
".",
"Specify",
"the",
"AuthToken",
"if",
"parameters",
"that",
"require",
"an",
"auth",
"token",
"is",
"used... | train | https://github.com/matomo-org/piwik-java-tracker/blob/23df71d27a89e89dc7a539b2eda88c90a206458b/src/main/java/org/piwik/java/tracking/PiwikTracker.java#L119-L147 |
lecousin/java-framework-core | net.lecousin.core/src/main/java/net/lecousin/framework/math/RangeInteger.java | RangeInteger.removeIntersect | public Pair<RangeInteger,RangeInteger> removeIntersect(RangeInteger o) {
if (o.max < min || o.min > max) // o is outside: no intersection
return new Pair<>(copy(), null);
if (o.min <= min) {
// nothing before
if (o.max >= max)
return new Pair<>(null, null); // o is fully overlapping this
return new Pair<>(null, new RangeInteger(o.max + 1, max));
}
if (o.max >= max) {
// nothing after
return new Pair<>(new RangeInteger(min, o.min - 1), null);
}
// in the middle
return new Pair<>(new RangeInteger(min, o.min - 1), new RangeInteger(o.max + 1, max));
} | java | public Pair<RangeInteger,RangeInteger> removeIntersect(RangeInteger o) {
if (o.max < min || o.min > max) // o is outside: no intersection
return new Pair<>(copy(), null);
if (o.min <= min) {
// nothing before
if (o.max >= max)
return new Pair<>(null, null); // o is fully overlapping this
return new Pair<>(null, new RangeInteger(o.max + 1, max));
}
if (o.max >= max) {
// nothing after
return new Pair<>(new RangeInteger(min, o.min - 1), null);
}
// in the middle
return new Pair<>(new RangeInteger(min, o.min - 1), new RangeInteger(o.max + 1, max));
} | [
"public",
"Pair",
"<",
"RangeInteger",
",",
"RangeInteger",
">",
"removeIntersect",
"(",
"RangeInteger",
"o",
")",
"{",
"if",
"(",
"o",
".",
"max",
"<",
"min",
"||",
"o",
".",
"min",
">",
"max",
")",
"// o is outside: no intersection\r",
"return",
"new",
"... | Remove the intersection between this range and the given range, and return the range before and the range after the intersection. | [
"Remove",
"the",
"intersection",
"between",
"this",
"range",
"and",
"the",
"given",
"range",
"and",
"return",
"the",
"range",
"before",
"and",
"the",
"range",
"after",
"the",
"intersection",
"."
] | train | https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/math/RangeInteger.java#L83-L98 |
cloudfoundry/uaa | server/src/main/java/org/cloudfoundry/identity/uaa/user/UaaUserApprovalHandler.java | UaaUserApprovalHandler.isApproved | @Override
public boolean isApproved(AuthorizationRequest authorizationRequest, Authentication userAuthentication) {
// if (useTokenServices && super.isApproved(authorizationRequest, userAuthentication)) {
// return true;
// }
if (!userAuthentication.isAuthenticated()) {
return false;
}
if (authorizationRequest.isApproved()) {
return true;
}
String clientId = authorizationRequest.getClientId();
boolean approved = false;
if (clientDetailsService != null) {
ClientDetails client = clientDetailsService.loadClientByClientId(clientId, IdentityZoneHolder.get().getId());
Collection<String> requestedScopes = authorizationRequest.getScope();
if (isAutoApprove(client, requestedScopes)) {
approved = true;
}
}
return approved;
} | java | @Override
public boolean isApproved(AuthorizationRequest authorizationRequest, Authentication userAuthentication) {
// if (useTokenServices && super.isApproved(authorizationRequest, userAuthentication)) {
// return true;
// }
if (!userAuthentication.isAuthenticated()) {
return false;
}
if (authorizationRequest.isApproved()) {
return true;
}
String clientId = authorizationRequest.getClientId();
boolean approved = false;
if (clientDetailsService != null) {
ClientDetails client = clientDetailsService.loadClientByClientId(clientId, IdentityZoneHolder.get().getId());
Collection<String> requestedScopes = authorizationRequest.getScope();
if (isAutoApprove(client, requestedScopes)) {
approved = true;
}
}
return approved;
} | [
"@",
"Override",
"public",
"boolean",
"isApproved",
"(",
"AuthorizationRequest",
"authorizationRequest",
",",
"Authentication",
"userAuthentication",
")",
"{",
"// if (useTokenServices && super.isApproved(authorizationRequest, userAuthentication)) {",
"// return true;",... | Allows automatic approval for a white list of clients in the implicit
grant case.
@param authorizationRequest The authorization request.
@param userAuthentication the current user authentication
@return Whether the specified request has been approved by the current
user. | [
"Allows",
"automatic",
"approval",
"for",
"a",
"white",
"list",
"of",
"clients",
"in",
"the",
"implicit",
"grant",
"case",
"."
] | train | https://github.com/cloudfoundry/uaa/blob/e8df3d7060580c92d33461106399f9e4f36e3cd2/server/src/main/java/org/cloudfoundry/identity/uaa/user/UaaUserApprovalHandler.java#L91-L112 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/DescendantIterator.java | DescendantIterator.setRoot | public void setRoot(int context, Object environment)
{
super.setRoot(context, environment);
m_traverser = m_cdtm.getAxisTraverser(m_axis);
String localName = getLocalName();
String namespace = getNamespace();
int what = m_whatToShow;
// System.out.println("what: ");
// NodeTest.debugWhatToShow(what);
if(DTMFilter.SHOW_ALL == what
|| NodeTest.WILD.equals(localName)
|| NodeTest.WILD.equals(namespace))
{
m_extendedTypeID = 0;
}
else
{
int type = getNodeTypeTest(what);
m_extendedTypeID = m_cdtm.getExpandedTypeID(namespace, localName, type);
}
} | java | public void setRoot(int context, Object environment)
{
super.setRoot(context, environment);
m_traverser = m_cdtm.getAxisTraverser(m_axis);
String localName = getLocalName();
String namespace = getNamespace();
int what = m_whatToShow;
// System.out.println("what: ");
// NodeTest.debugWhatToShow(what);
if(DTMFilter.SHOW_ALL == what
|| NodeTest.WILD.equals(localName)
|| NodeTest.WILD.equals(namespace))
{
m_extendedTypeID = 0;
}
else
{
int type = getNodeTypeTest(what);
m_extendedTypeID = m_cdtm.getExpandedTypeID(namespace, localName, type);
}
} | [
"public",
"void",
"setRoot",
"(",
"int",
"context",
",",
"Object",
"environment",
")",
"{",
"super",
".",
"setRoot",
"(",
"context",
",",
"environment",
")",
";",
"m_traverser",
"=",
"m_cdtm",
".",
"getAxisTraverser",
"(",
"m_axis",
")",
";",
"String",
"lo... | Initialize the context values for this expression
after it is cloned.
@param context The XPath runtime context for this
transformation. | [
"Initialize",
"the",
"context",
"values",
"for",
"this",
"expression",
"after",
"it",
"is",
"cloned",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/DescendantIterator.java#L261-L283 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/actions/MpJwtFatActions.java | MpJwtFatActions.getJwtTokenUsingBuilder | public String getJwtTokenUsingBuilder(String testName, LibertyServer server, List<NameValuePair> extraClaims) throws Exception {
return getJwtTokenUsingBuilder(testName, server, "defaultJWT_withAudience", extraClaims);
} | java | public String getJwtTokenUsingBuilder(String testName, LibertyServer server, List<NameValuePair> extraClaims) throws Exception {
return getJwtTokenUsingBuilder(testName, server, "defaultJWT_withAudience", extraClaims);
} | [
"public",
"String",
"getJwtTokenUsingBuilder",
"(",
"String",
"testName",
",",
"LibertyServer",
"server",
",",
"List",
"<",
"NameValuePair",
">",
"extraClaims",
")",
"throws",
"Exception",
"{",
"return",
"getJwtTokenUsingBuilder",
"(",
"testName",
",",
"server",
","... | anyone calling this method needs to add upn to the extraClaims that it passes in (if they need it) | [
"anyone",
"calling",
"this",
"method",
"needs",
"to",
"add",
"upn",
"to",
"the",
"extraClaims",
"that",
"it",
"passes",
"in",
"(",
"if",
"they",
"need",
"it",
")"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/actions/MpJwtFatActions.java#L112-L114 |
lestard/assertj-javafx | src/main/java/eu/lestard/assertj/javafx/api/FloatBindingAssert.java | FloatBindingAssert.hasValue | public FloatBindingAssert hasValue(Double expectedValue, Offset offset){
new ObservableNumberValueAssertions(actual).hasValue(expectedValue, offset);
return this;
} | java | public FloatBindingAssert hasValue(Double expectedValue, Offset offset){
new ObservableNumberValueAssertions(actual).hasValue(expectedValue, offset);
return this;
} | [
"public",
"FloatBindingAssert",
"hasValue",
"(",
"Double",
"expectedValue",
",",
"Offset",
"offset",
")",
"{",
"new",
"ObservableNumberValueAssertions",
"(",
"actual",
")",
".",
"hasValue",
"(",
"expectedValue",
",",
"offset",
")",
";",
"return",
"this",
";",
"}... | Verifies that the actual observable number has a value that is close to the given one by less then the given offset.
@param expectedValue the given value to compare the actual observables value to.
@param offset the given positive offset.
@return {@code this} assertion object.
@throws java.lang.NullPointerException if the given offset is <code>null</code>.
@throws java.lang.AssertionError if the actual observables value is not equal to the expected one. | [
"Verifies",
"that",
"the",
"actual",
"observable",
"number",
"has",
"a",
"value",
"that",
"is",
"close",
"to",
"the",
"given",
"one",
"by",
"less",
"then",
"the",
"given",
"offset",
"."
] | train | https://github.com/lestard/assertj-javafx/blob/f6b4d22e542a5501c7c1c2fae8700b0f69b956c1/src/main/java/eu/lestard/assertj/javafx/api/FloatBindingAssert.java#L48-L52 |
cdk/cdk | tool/sdg/src/main/java/org/openscience/cdk/layout/LayoutRefiner.java | LayoutRefiner.makeAtmBndQueues | private void makeAtmBndQueues(int[] path, int[] seqAt, IBond[] bndAt) {
int len = path.length;
int i = (len - 1) / 2;
int j = i + 1;
int nSeqAt = 0;
int nBndAt = 0;
if (isOdd((path.length))) {
seqAt[nSeqAt++] = path[i--];
bndAt[nBndAt++] = bondMap.get(path[j], path[j - 1]);
}
bndAt[nBndAt++] = bondMap.get(path[i], path[i + 1]);
while (i > 0 && j < len - 1) {
seqAt[nSeqAt++] = path[i--];
seqAt[nSeqAt++] = path[j++];
bndAt[nBndAt++] = bondMap.get(path[i], path[i + 1]);
bndAt[nBndAt++] = bondMap.get(path[j], path[j - 1]);
}
} | java | private void makeAtmBndQueues(int[] path, int[] seqAt, IBond[] bndAt) {
int len = path.length;
int i = (len - 1) / 2;
int j = i + 1;
int nSeqAt = 0;
int nBndAt = 0;
if (isOdd((path.length))) {
seqAt[nSeqAt++] = path[i--];
bndAt[nBndAt++] = bondMap.get(path[j], path[j - 1]);
}
bndAt[nBndAt++] = bondMap.get(path[i], path[i + 1]);
while (i > 0 && j < len - 1) {
seqAt[nSeqAt++] = path[i--];
seqAt[nSeqAt++] = path[j++];
bndAt[nBndAt++] = bondMap.get(path[i], path[i + 1]);
bndAt[nBndAt++] = bondMap.get(path[j], path[j - 1]);
}
} | [
"private",
"void",
"makeAtmBndQueues",
"(",
"int",
"[",
"]",
"path",
",",
"int",
"[",
"]",
"seqAt",
",",
"IBond",
"[",
"]",
"bndAt",
")",
"{",
"int",
"len",
"=",
"path",
".",
"length",
";",
"int",
"i",
"=",
"(",
"len",
"-",
"1",
")",
"/",
"2",
... | Internal - makes atom (seq) and bond priority queues for resolving
overlap. Only (acyclic - but not really) atoms and bonds in the shortest
path between the two atoms can resolve an overlap. We create prioritised
sequences of atoms/bonds where the more central in the shortest path.
@param path shortest path between atoms
@param seqAt prioritised atoms, first atom is the middle of the path
@param bndAt prioritised bonds, first bond is the middle of the path | [
"Internal",
"-",
"makes",
"atom",
"(",
"seq",
")",
"and",
"bond",
"priority",
"queues",
"for",
"resolving",
"overlap",
".",
"Only",
"(",
"acyclic",
"-",
"but",
"not",
"really",
")",
"atoms",
"and",
"bonds",
"in",
"the",
"shortest",
"path",
"between",
"th... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/LayoutRefiner.java#L959-L976 |
ralscha/extdirectspring | src/main/java/ch/ralscha/extdirectspring/util/JsonHandler.java | JsonHandler.readValue | public Object readValue(InputStream is, Class<Object> clazz) {
try {
return this.mapper.readValue(is, clazz);
}
catch (Exception e) {
LogFactory.getLog(JsonHandler.class).info("deserialize json to object", e);
return null;
}
} | java | public Object readValue(InputStream is, Class<Object> clazz) {
try {
return this.mapper.readValue(is, clazz);
}
catch (Exception e) {
LogFactory.getLog(JsonHandler.class).info("deserialize json to object", e);
return null;
}
} | [
"public",
"Object",
"readValue",
"(",
"InputStream",
"is",
",",
"Class",
"<",
"Object",
">",
"clazz",
")",
"{",
"try",
"{",
"return",
"this",
".",
"mapper",
".",
"readValue",
"(",
"is",
",",
"clazz",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")"... | Converts a JSON string into an object. The input is read from an InputStream. In
case of an exception returns null and logs the exception.
@param is a InputStream
@param clazz class of object to create
@return the converted object, null if there is an exception | [
"Converts",
"a",
"JSON",
"string",
"into",
"an",
"object",
".",
"The",
"input",
"is",
"read",
"from",
"an",
"InputStream",
".",
"In",
"case",
"of",
"an",
"exception",
"returns",
"null",
"and",
"logs",
"the",
"exception",
"."
] | train | https://github.com/ralscha/extdirectspring/blob/4b018497c4e7503033f91d0491b4e74bf8291d2c/src/main/java/ch/ralscha/extdirectspring/util/JsonHandler.java#L142-L150 |
ModeShape/modeshape | web/modeshape-webdav/src/main/java/org/modeshape/webdav/locking/ResourceLocks.java | ResourceLocks.generateTempLockedObjects | private LockedObject generateTempLockedObjects( String path ) {
if (!tempLocks.containsKey(path)) {
LockedObject returnObject = new LockedObject(this, path, temporary);
String parentPath = getParentPath(path);
if (parentPath != null) {
LockedObject parentLockedObject = generateTempLockedObjects(parentPath);
parentLockedObject.addChild(returnObject);
returnObject.parent = parentLockedObject;
}
return returnObject;
}
// there is already a LockedObject on the specified path
return this.tempLocks.get(path);
} | java | private LockedObject generateTempLockedObjects( String path ) {
if (!tempLocks.containsKey(path)) {
LockedObject returnObject = new LockedObject(this, path, temporary);
String parentPath = getParentPath(path);
if (parentPath != null) {
LockedObject parentLockedObject = generateTempLockedObjects(parentPath);
parentLockedObject.addChild(returnObject);
returnObject.parent = parentLockedObject;
}
return returnObject;
}
// there is already a LockedObject on the specified path
return this.tempLocks.get(path);
} | [
"private",
"LockedObject",
"generateTempLockedObjects",
"(",
"String",
"path",
")",
"{",
"if",
"(",
"!",
"tempLocks",
".",
"containsKey",
"(",
"path",
")",
")",
"{",
"LockedObject",
"returnObject",
"=",
"new",
"LockedObject",
"(",
"this",
",",
"path",
",",
"... | generates temporary LockedObjects for the resource at path and its parent folders. does not create new LockedObjects if
they already exist
@param path path to the (new) LockedObject
@return the LockedObject for path. | [
"generates",
"temporary",
"LockedObjects",
"for",
"the",
"resource",
"at",
"path",
"and",
"its",
"parent",
"folders",
".",
"does",
"not",
"create",
"new",
"LockedObjects",
"if",
"they",
"already",
"exist"
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/web/modeshape-webdav/src/main/java/org/modeshape/webdav/locking/ResourceLocks.java#L284-L297 |
samskivert/samskivert | src/main/java/com/samskivert/util/Folds.java | Folds.reduceLeft | public static <A> A reduceLeft (F<A,A> func, Iterable<? extends A> values)
{
Iterator<? extends A> iter = values.iterator();
A zero = iter.next();
while (iter.hasNext()) {
zero = func.apply(zero, iter.next());
}
return zero;
} | java | public static <A> A reduceLeft (F<A,A> func, Iterable<? extends A> values)
{
Iterator<? extends A> iter = values.iterator();
A zero = iter.next();
while (iter.hasNext()) {
zero = func.apply(zero, iter.next());
}
return zero;
} | [
"public",
"static",
"<",
"A",
">",
"A",
"reduceLeft",
"(",
"F",
"<",
"A",
",",
"A",
">",
"func",
",",
"Iterable",
"<",
"?",
"extends",
"A",
">",
"values",
")",
"{",
"Iterator",
"<",
"?",
"extends",
"A",
">",
"iter",
"=",
"values",
".",
"iterator"... | Reduces the supplied values using the supplied function with a left fold.
@exception NoSuchElementException thrown if values does not contain at least one element. | [
"Reduces",
"the",
"supplied",
"values",
"using",
"the",
"supplied",
"function",
"with",
"a",
"left",
"fold",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/Folds.java#L43-L51 |
cdk/cdk | tool/hash/src/main/java/org/openscience/cdk/hash/stereo/GeometricTetrahedralEncoderFactory.java | GeometricTetrahedralEncoderFactory.geometric2D | private static GeometricParity geometric2D(Map<IAtom, Integer> elevationMap, List<IBond> bonds, int i,
int[] adjacent, IAtomContainer container) {
IAtom atom = container.getAtom(i);
// create map of the atoms and their elevation from the center,
makeElevationMap(atom, bonds, elevationMap);
Point2d[] coordinates = new Point2d[4];
int[] elevations = new int[4];
// set the forth ligand to centre as default (overwritten if
// we have 4 neighbors)
if (atom.getPoint2d() != null)
coordinates[3] = atom.getPoint2d();
else
return null;
for (int j = 0; j < adjacent.length; j++) {
IAtom neighbor = container.getAtom(adjacent[j]);
elevations[j] = elevationMap.get(neighbor);
if (neighbor.getPoint2d() != null)
coordinates[j] = neighbor.getPoint2d();
else
return null; // skip to next atom
}
return new Tetrahedral2DParity(coordinates, elevations);
} | java | private static GeometricParity geometric2D(Map<IAtom, Integer> elevationMap, List<IBond> bonds, int i,
int[] adjacent, IAtomContainer container) {
IAtom atom = container.getAtom(i);
// create map of the atoms and their elevation from the center,
makeElevationMap(atom, bonds, elevationMap);
Point2d[] coordinates = new Point2d[4];
int[] elevations = new int[4];
// set the forth ligand to centre as default (overwritten if
// we have 4 neighbors)
if (atom.getPoint2d() != null)
coordinates[3] = atom.getPoint2d();
else
return null;
for (int j = 0; j < adjacent.length; j++) {
IAtom neighbor = container.getAtom(adjacent[j]);
elevations[j] = elevationMap.get(neighbor);
if (neighbor.getPoint2d() != null)
coordinates[j] = neighbor.getPoint2d();
else
return null; // skip to next atom
}
return new Tetrahedral2DParity(coordinates, elevations);
} | [
"private",
"static",
"GeometricParity",
"geometric2D",
"(",
"Map",
"<",
"IAtom",
",",
"Integer",
">",
"elevationMap",
",",
"List",
"<",
"IBond",
">",
"bonds",
",",
"int",
"i",
",",
"int",
"[",
"]",
"adjacent",
",",
"IAtomContainer",
"container",
")",
"{",
... | Create the geometric part of an encoder of 2D configurations
@param elevationMap temporary map to store the bond elevations (2D)
@param bonds list of bonds connected to the atom at i
@param i the central atom (index)
@param adjacent adjacent atoms (indices)
@param container container
@return geometric parity encoder (or null) | [
"Create",
"the",
"geometric",
"part",
"of",
"an",
"encoder",
"of",
"2D",
"configurations"
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/hash/src/main/java/org/openscience/cdk/hash/stereo/GeometricTetrahedralEncoderFactory.java#L144-L175 |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java | Graph.fromCsvReader | public static GraphCsvReader fromCsvReader(String verticesPath, String edgesPath, ExecutionEnvironment context) {
return new GraphCsvReader(verticesPath, edgesPath, context);
} | java | public static GraphCsvReader fromCsvReader(String verticesPath, String edgesPath, ExecutionEnvironment context) {
return new GraphCsvReader(verticesPath, edgesPath, context);
} | [
"public",
"static",
"GraphCsvReader",
"fromCsvReader",
"(",
"String",
"verticesPath",
",",
"String",
"edgesPath",
",",
"ExecutionEnvironment",
"context",
")",
"{",
"return",
"new",
"GraphCsvReader",
"(",
"verticesPath",
",",
"edgesPath",
",",
"context",
")",
";",
... | Creates a Graph from a CSV file of vertices and a CSV file of edges.
@param verticesPath path to a CSV file with the Vertex data.
@param edgesPath path to a CSV file with the Edge data
@param context the Flink execution environment.
@return An instance of {@link org.apache.flink.graph.GraphCsvReader},
on which calling methods to specify types of the Vertex ID, Vertex value and Edge value returns a Graph.
@see org.apache.flink.graph.GraphCsvReader#types(Class, Class, Class)
@see org.apache.flink.graph.GraphCsvReader#vertexTypes(Class, Class)
@see org.apache.flink.graph.GraphCsvReader#edgeTypes(Class, Class)
@see org.apache.flink.graph.GraphCsvReader#keyType(Class) | [
"Creates",
"a",
"Graph",
"from",
"a",
"CSV",
"file",
"of",
"vertices",
"and",
"a",
"CSV",
"file",
"of",
"edges",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L391-L393 |
mabe02/lanterna | src/main/java/com/googlecode/lanterna/gui2/dialogs/WaitingDialog.java | WaitingDialog.showDialog | public static WaitingDialog showDialog(WindowBasedTextGUI textGUI, String title, String text) {
WaitingDialog waitingDialog = createDialog(title, text);
waitingDialog.showDialog(textGUI, false);
return waitingDialog;
} | java | public static WaitingDialog showDialog(WindowBasedTextGUI textGUI, String title, String text) {
WaitingDialog waitingDialog = createDialog(title, text);
waitingDialog.showDialog(textGUI, false);
return waitingDialog;
} | [
"public",
"static",
"WaitingDialog",
"showDialog",
"(",
"WindowBasedTextGUI",
"textGUI",
",",
"String",
"title",
",",
"String",
"text",
")",
"{",
"WaitingDialog",
"waitingDialog",
"=",
"createDialog",
"(",
"title",
",",
"text",
")",
";",
"waitingDialog",
".",
"s... | Creates and displays a waiting dialog without blocking for it to finish
@param textGUI GUI to add the dialog to
@param title Title of the waiting dialog
@param text Text to display on the waiting dialog
@return Created waiting dialog | [
"Creates",
"and",
"displays",
"a",
"waiting",
"dialog",
"without",
"blocking",
"for",
"it",
"to",
"finish"
] | train | https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/gui2/dialogs/WaitingDialog.java#L76-L80 |
cdapio/tigon | tigon-flow/src/main/java/co/cask/tigon/internal/app/runtime/flow/FlowUtils.java | FlowUtils.configureQueue | public static Multimap<String, QueueName> configureQueue(Program program, FlowSpecification flowSpec,
QueueAdmin queueAdmin) {
// Generate all queues specifications
Table<QueueSpecificationGenerator.Node, String, Set<QueueSpecification>> queueSpecs
= new SimpleQueueSpecificationGenerator().create(flowSpec);
// For each queue in the flow, gather a map of consumer groupId to number of instances
Table<QueueName, Long, Integer> queueConfigs = HashBasedTable.create();
// For storing result from flowletId to queue.
ImmutableSetMultimap.Builder<String, QueueName> resultBuilder = ImmutableSetMultimap.builder();
// Loop through each flowlet
for (Map.Entry<String, FlowletDefinition> entry : flowSpec.getFlowlets().entrySet()) {
String flowletId = entry.getKey();
long groupId = FlowUtils.generateConsumerGroupId(program, flowletId);
int instances = entry.getValue().getInstances();
// For each queue that the flowlet is a consumer, store the number of instances for this flowlet
for (QueueSpecification queueSpec : Iterables.concat(queueSpecs.column(flowletId).values())) {
queueConfigs.put(queueSpec.getQueueName(), groupId, instances);
resultBuilder.put(flowletId, queueSpec.getQueueName());
}
}
try {
// For each queue in the flow, configure it through QueueAdmin
for (Map.Entry<QueueName, Map<Long, Integer>> row : queueConfigs.rowMap().entrySet()) {
LOG.info("Queue config for {} : {}", row.getKey(), row.getValue());
queueAdmin.configureGroups(row.getKey(), row.getValue());
}
return resultBuilder.build();
} catch (Exception e) {
LOG.error("Failed to configure queues", e);
throw Throwables.propagate(e);
}
} | java | public static Multimap<String, QueueName> configureQueue(Program program, FlowSpecification flowSpec,
QueueAdmin queueAdmin) {
// Generate all queues specifications
Table<QueueSpecificationGenerator.Node, String, Set<QueueSpecification>> queueSpecs
= new SimpleQueueSpecificationGenerator().create(flowSpec);
// For each queue in the flow, gather a map of consumer groupId to number of instances
Table<QueueName, Long, Integer> queueConfigs = HashBasedTable.create();
// For storing result from flowletId to queue.
ImmutableSetMultimap.Builder<String, QueueName> resultBuilder = ImmutableSetMultimap.builder();
// Loop through each flowlet
for (Map.Entry<String, FlowletDefinition> entry : flowSpec.getFlowlets().entrySet()) {
String flowletId = entry.getKey();
long groupId = FlowUtils.generateConsumerGroupId(program, flowletId);
int instances = entry.getValue().getInstances();
// For each queue that the flowlet is a consumer, store the number of instances for this flowlet
for (QueueSpecification queueSpec : Iterables.concat(queueSpecs.column(flowletId).values())) {
queueConfigs.put(queueSpec.getQueueName(), groupId, instances);
resultBuilder.put(flowletId, queueSpec.getQueueName());
}
}
try {
// For each queue in the flow, configure it through QueueAdmin
for (Map.Entry<QueueName, Map<Long, Integer>> row : queueConfigs.rowMap().entrySet()) {
LOG.info("Queue config for {} : {}", row.getKey(), row.getValue());
queueAdmin.configureGroups(row.getKey(), row.getValue());
}
return resultBuilder.build();
} catch (Exception e) {
LOG.error("Failed to configure queues", e);
throw Throwables.propagate(e);
}
} | [
"public",
"static",
"Multimap",
"<",
"String",
",",
"QueueName",
">",
"configureQueue",
"(",
"Program",
"program",
",",
"FlowSpecification",
"flowSpec",
",",
"QueueAdmin",
"queueAdmin",
")",
"{",
"// Generate all queues specifications",
"Table",
"<",
"QueueSpecification... | Configures all queues being used in a flow.
@return A Multimap from flowletId to QueueName where the flowlet is a consumer of. | [
"Configures",
"all",
"queues",
"being",
"used",
"in",
"a",
"flow",
"."
] | train | https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-flow/src/main/java/co/cask/tigon/internal/app/runtime/flow/FlowUtils.java#L68-L104 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/tracker/tld/TldFernClassifier.java | TldFernClassifier.learnFernNoise | public void learnFernNoise(boolean positive, ImageRectangle r) {
float rectWidth = r.getWidth();
float rectHeight = r.getHeight();
float c_x = r.x0+(rectWidth-1)/2.0f;
float c_y = r.y0+(rectHeight-1)/2.0f;
for( int i = 0; i < ferns.length; i++ ) {
// first learn it with no noise
int value = computeFernValue(c_x, c_y, rectWidth, rectHeight,ferns[i]);
TldFernFeature f = managers[i].lookupFern(value);
increment(f,positive);
for( int j = 0; j < numLearnRandom; j++ ) {
value = computeFernValueRand(c_x, c_y, rectWidth, rectHeight,ferns[i]);
f = managers[i].lookupFern(value);
increment(f,positive);
}
}
} | java | public void learnFernNoise(boolean positive, ImageRectangle r) {
float rectWidth = r.getWidth();
float rectHeight = r.getHeight();
float c_x = r.x0+(rectWidth-1)/2.0f;
float c_y = r.y0+(rectHeight-1)/2.0f;
for( int i = 0; i < ferns.length; i++ ) {
// first learn it with no noise
int value = computeFernValue(c_x, c_y, rectWidth, rectHeight,ferns[i]);
TldFernFeature f = managers[i].lookupFern(value);
increment(f,positive);
for( int j = 0; j < numLearnRandom; j++ ) {
value = computeFernValueRand(c_x, c_y, rectWidth, rectHeight,ferns[i]);
f = managers[i].lookupFern(value);
increment(f,positive);
}
}
} | [
"public",
"void",
"learnFernNoise",
"(",
"boolean",
"positive",
",",
"ImageRectangle",
"r",
")",
"{",
"float",
"rectWidth",
"=",
"r",
".",
"getWidth",
"(",
")",
";",
"float",
"rectHeight",
"=",
"r",
".",
"getHeight",
"(",
")",
";",
"float",
"c_x",
"=",
... | Computes the value for each fern inside the region and update's their P and N value. Noise is added
to the image measurements to take in account the variability. | [
"Computes",
"the",
"value",
"for",
"each",
"fern",
"inside",
"the",
"region",
"and",
"update",
"s",
"their",
"P",
"and",
"N",
"value",
".",
"Noise",
"is",
"added",
"to",
"the",
"image",
"measurements",
"to",
"take",
"in",
"account",
"the",
"variability",
... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/tld/TldFernClassifier.java#L127-L148 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/string/Strs.java | Strs.startAny | public static boolean startAny(String target, String... startWith) {
return startAny(target, 0, Arrays.asList(startWith));
} | java | public static boolean startAny(String target, String... startWith) {
return startAny(target, 0, Arrays.asList(startWith));
} | [
"public",
"static",
"boolean",
"startAny",
"(",
"String",
"target",
",",
"String",
"...",
"startWith",
")",
"{",
"return",
"startAny",
"(",
"target",
",",
"0",
",",
"Arrays",
".",
"asList",
"(",
"startWith",
")",
")",
";",
"}"
] | Check if target string starts with any of an array of specified strings.
@param target
@param startWith
@return | [
"Check",
"if",
"target",
"string",
"starts",
"with",
"any",
"of",
"an",
"array",
"of",
"specified",
"strings",
"."
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/Strs.java#L329-L331 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/AccessHelper.java | AccessHelper.createFileOutputStream | static FileOutputStream createFileOutputStream(final File file, final boolean append) throws IOException
{
try {
FileOutputStream fs = getInstance().doPrivileged(
new PrivilegedExceptionAction<FileOutputStream>() {
public FileOutputStream run() throws IOException {
if (file instanceof GenericOutputFile) {
return ((GenericOutputFile)file).createOutputStream(append);
} else {
return new FileOutputStream(file, append);
}
}
}
);
return fs;
}
catch (PrivilegedActionException ex) {
throw new IOException("Unable to create FileOutputStream over file "+file.getName(), ex);
}
} | java | static FileOutputStream createFileOutputStream(final File file, final boolean append) throws IOException
{
try {
FileOutputStream fs = getInstance().doPrivileged(
new PrivilegedExceptionAction<FileOutputStream>() {
public FileOutputStream run() throws IOException {
if (file instanceof GenericOutputFile) {
return ((GenericOutputFile)file).createOutputStream(append);
} else {
return new FileOutputStream(file, append);
}
}
}
);
return fs;
}
catch (PrivilegedActionException ex) {
throw new IOException("Unable to create FileOutputStream over file "+file.getName(), ex);
}
} | [
"static",
"FileOutputStream",
"createFileOutputStream",
"(",
"final",
"File",
"file",
",",
"final",
"boolean",
"append",
")",
"throws",
"IOException",
"{",
"try",
"{",
"FileOutputStream",
"fs",
"=",
"getInstance",
"(",
")",
".",
"doPrivileged",
"(",
"new",
"Priv... | Using privileged security, create a <code>FileOutputStream</code> over the
specified file, using the appropriate truncate/append semantics.
<p>
@param file the name of the file. The caller must guarantee this is non-null
@param append if true, append to the file if it exists, if false, truncate
the file (this is the default behavior).
@return a FileOutputStream object
@exception IOException an exception was encountered while attempting to create
the FileOutputStream. | [
"Using",
"privileged",
"security",
"create",
"a",
"<code",
">",
"FileOutputStream<",
"/",
"code",
">",
"over",
"the",
"specified",
"file",
"using",
"the",
"appropriate",
"truncate",
"/",
"append",
"semantics",
".",
"<p",
">"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/AccessHelper.java#L319-L338 |
redkale/redkale-plugins | src/org/redkalex/weixin/WeiXinQYService.java | WeiXinQYService.encryptQY | protected String encryptQY(String randomStr, String text) {
ByteArray bytes = new ByteArray();
byte[] randomStrBytes = randomStr.getBytes(CHARSET);
byte[] textBytes = text.getBytes(CHARSET);
byte[] corpidBytes = qycorpid.getBytes(CHARSET);
// randomStr + networkBytesOrder + text + qycorpid
bytes.write(randomStrBytes);
bytes.writeInt(textBytes.length);
bytes.write(textBytes);
bytes.write(corpidBytes);
// ... + pad: 使用自定义的填充方式对明文进行补位填充
byte[] padBytes = encodePKCS7(bytes.size());
bytes.write(padBytes);
// 获得最终的字节流, 未加密
try {
// 加密
byte[] encrypted = createQYCipher(Cipher.ENCRYPT_MODE).doFinal(bytes.directBytes(), 0, bytes.size());
// 使用BASE64对加密后的字符串进行编码
return Base64.getEncoder().encodeToString(encrypted);
} catch (Exception e) {
throw new RuntimeException("AES加密失败", e);
}
} | java | protected String encryptQY(String randomStr, String text) {
ByteArray bytes = new ByteArray();
byte[] randomStrBytes = randomStr.getBytes(CHARSET);
byte[] textBytes = text.getBytes(CHARSET);
byte[] corpidBytes = qycorpid.getBytes(CHARSET);
// randomStr + networkBytesOrder + text + qycorpid
bytes.write(randomStrBytes);
bytes.writeInt(textBytes.length);
bytes.write(textBytes);
bytes.write(corpidBytes);
// ... + pad: 使用自定义的填充方式对明文进行补位填充
byte[] padBytes = encodePKCS7(bytes.size());
bytes.write(padBytes);
// 获得最终的字节流, 未加密
try {
// 加密
byte[] encrypted = createQYCipher(Cipher.ENCRYPT_MODE).doFinal(bytes.directBytes(), 0, bytes.size());
// 使用BASE64对加密后的字符串进行编码
return Base64.getEncoder().encodeToString(encrypted);
} catch (Exception e) {
throw new RuntimeException("AES加密失败", e);
}
} | [
"protected",
"String",
"encryptQY",
"(",
"String",
"randomStr",
",",
"String",
"text",
")",
"{",
"ByteArray",
"bytes",
"=",
"new",
"ByteArray",
"(",
")",
";",
"byte",
"[",
"]",
"randomStrBytes",
"=",
"randomStr",
".",
"getBytes",
"(",
"CHARSET",
")",
";",
... | 对明文进行加密.
<p>
@param randomStr String
@param text 需要加密的明文
@return 加密后base64编码的字符串 | [
"对明文进行加密",
".",
"<p",
">",
"@param",
"randomStr",
"String",
"@param",
"text",
"需要加密的明文"
] | train | https://github.com/redkale/redkale-plugins/blob/a1edfc906a444ae19fe6aababce2957c9b5ea9d2/src/org/redkalex/weixin/WeiXinQYService.java#L196-L221 |
alkacon/opencms-core | src/org/opencms/main/CmsShellCommands.java | CmsShellCommands.touchResource | public void touchResource(String resourcePath) throws Exception {
CmsResource resource = m_cms.readResource(resourcePath);
CmsLockActionRecord action = CmsLockUtil.ensureLock(m_cms, resource);
try {
OpenCms.getWorkplaceManager().flushMessageCache();
// One important reason for touching resources via the shell is to write mapped values containing
// localization macros to properties, so we flush the workplace messages immediately before the touch operation
// in case an older version of the workplace messages (not containing the keys we need) has already been cached
touchSingleResource(m_cms, resourcePath, System.currentTimeMillis(), true, true, true);
} finally {
if (action.getChange() == LockChange.locked) {
m_cms.unlockResource(resource);
}
}
} | java | public void touchResource(String resourcePath) throws Exception {
CmsResource resource = m_cms.readResource(resourcePath);
CmsLockActionRecord action = CmsLockUtil.ensureLock(m_cms, resource);
try {
OpenCms.getWorkplaceManager().flushMessageCache();
// One important reason for touching resources via the shell is to write mapped values containing
// localization macros to properties, so we flush the workplace messages immediately before the touch operation
// in case an older version of the workplace messages (not containing the keys we need) has already been cached
touchSingleResource(m_cms, resourcePath, System.currentTimeMillis(), true, true, true);
} finally {
if (action.getChange() == LockChange.locked) {
m_cms.unlockResource(resource);
}
}
} | [
"public",
"void",
"touchResource",
"(",
"String",
"resourcePath",
")",
"throws",
"Exception",
"{",
"CmsResource",
"resource",
"=",
"m_cms",
".",
"readResource",
"(",
"resourcePath",
")",
";",
"CmsLockActionRecord",
"action",
"=",
"CmsLockUtil",
".",
"ensureLock",
... | Touches a resource and all its children.<p>
This method also rewrites the content for all files in the subtree.
@param resourcePath the site path of the resource
@throws Exception if something goes wrong | [
"Touches",
"a",
"resource",
"and",
"all",
"its",
"children",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsShellCommands.java#L1686-L1701 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/JobId.java | JobId.of | public static JobId of(String project, String job) {
return newBuilder().setProject(checkNotNull(project)).setJob(checkNotNull(job)).build();
} | java | public static JobId of(String project, String job) {
return newBuilder().setProject(checkNotNull(project)).setJob(checkNotNull(job)).build();
} | [
"public",
"static",
"JobId",
"of",
"(",
"String",
"project",
",",
"String",
"job",
")",
"{",
"return",
"newBuilder",
"(",
")",
".",
"setProject",
"(",
"checkNotNull",
"(",
"project",
")",
")",
".",
"setJob",
"(",
"checkNotNull",
"(",
"job",
")",
")",
"... | Creates a job identity given project's and job's user-defined id. | [
"Creates",
"a",
"job",
"identity",
"given",
"project",
"s",
"and",
"job",
"s",
"user",
"-",
"defined",
"id",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/JobId.java#L86-L88 |
oboehm/jfachwert | src/main/java/de/jfachwert/post/Adresse.java | Adresse.validate | public static void validate(Ort ort, String strasse, String hausnummer) {
if (StringUtils.isBlank(strasse)) {
throw new InvalidValueException(strasse, "street");
}
validate(ort, strasse, hausnummer, VALIDATOR);
} | java | public static void validate(Ort ort, String strasse, String hausnummer) {
if (StringUtils.isBlank(strasse)) {
throw new InvalidValueException(strasse, "street");
}
validate(ort, strasse, hausnummer, VALIDATOR);
} | [
"public",
"static",
"void",
"validate",
"(",
"Ort",
"ort",
",",
"String",
"strasse",
",",
"String",
"hausnummer",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"strasse",
")",
")",
"{",
"throw",
"new",
"InvalidValueException",
"(",
"strasse",
",... | Validiert die uebergebene Adresse auf moegliche Fehler.
@param ort der Ort
@param strasse die Strasse
@param hausnummer die Hausnummer | [
"Validiert",
"die",
"uebergebene",
"Adresse",
"auf",
"moegliche",
"Fehler",
"."
] | train | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/post/Adresse.java#L187-L192 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/util/JsonUtil.java | JsonUtil.getLong | public static long getLong(JsonObject object, String field) {
final JsonValue value = object.get(field);
throwExceptionIfNull(value, field);
return value.asLong();
} | java | public static long getLong(JsonObject object, String field) {
final JsonValue value = object.get(field);
throwExceptionIfNull(value, field);
return value.asLong();
} | [
"public",
"static",
"long",
"getLong",
"(",
"JsonObject",
"object",
",",
"String",
"field",
")",
"{",
"final",
"JsonValue",
"value",
"=",
"object",
".",
"get",
"(",
"field",
")",
";",
"throwExceptionIfNull",
"(",
"value",
",",
"field",
")",
";",
"return",
... | Returns a field in a Json object as a long.
Throws IllegalArgumentException if the field value is null.
@param object the Json Object
@param field the field in the Json object to return
@return the Json field value as a long | [
"Returns",
"a",
"field",
"in",
"a",
"Json",
"object",
"as",
"a",
"long",
".",
"Throws",
"IllegalArgumentException",
"if",
"the",
"field",
"value",
"is",
"null",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/JsonUtil.java#L76-L80 |
Azure/azure-sdk-for-java | logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/IntegrationAccountsInner.java | IntegrationAccountsInner.listKeyVaultKeysAsync | public Observable<List<KeyVaultKeyInner>> listKeyVaultKeysAsync(String resourceGroupName, String integrationAccountName, ListKeyVaultKeysDefinition listKeyVaultKeys) {
return listKeyVaultKeysWithServiceResponseAsync(resourceGroupName, integrationAccountName, listKeyVaultKeys).map(new Func1<ServiceResponse<List<KeyVaultKeyInner>>, List<KeyVaultKeyInner>>() {
@Override
public List<KeyVaultKeyInner> call(ServiceResponse<List<KeyVaultKeyInner>> response) {
return response.body();
}
});
} | java | public Observable<List<KeyVaultKeyInner>> listKeyVaultKeysAsync(String resourceGroupName, String integrationAccountName, ListKeyVaultKeysDefinition listKeyVaultKeys) {
return listKeyVaultKeysWithServiceResponseAsync(resourceGroupName, integrationAccountName, listKeyVaultKeys).map(new Func1<ServiceResponse<List<KeyVaultKeyInner>>, List<KeyVaultKeyInner>>() {
@Override
public List<KeyVaultKeyInner> call(ServiceResponse<List<KeyVaultKeyInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"KeyVaultKeyInner",
">",
">",
"listKeyVaultKeysAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"integrationAccountName",
",",
"ListKeyVaultKeysDefinition",
"listKeyVaultKeys",
")",
"{",
"return",
"listKeyVaultKeysWithServ... | Gets the integration account's Key Vault keys.
@param resourceGroupName The resource group name.
@param integrationAccountName The integration account name.
@param listKeyVaultKeys The key vault parameters.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<KeyVaultKeyInner> object | [
"Gets",
"the",
"integration",
"account",
"s",
"Key",
"Vault",
"keys",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/IntegrationAccountsInner.java#L1059-L1066 |
forge/core | javaee/scaffold-faces/src/main/java/org/jboss/forge/addon/scaffold/faces/freemarker/FreemarkerTemplateProcessor.java | FreemarkerTemplateProcessor.processTemplate | public static String processTemplate(Map<Object, Object> map, Template template)
{
Writer output = new StringWriter();
try
{
template.process(map, output);
output.flush();
}
catch (IOException ioEx)
{
throw new RuntimeException(ioEx);
}
catch (TemplateException templateEx)
{
throw new RuntimeException(templateEx);
}
return output.toString();
} | java | public static String processTemplate(Map<Object, Object> map, Template template)
{
Writer output = new StringWriter();
try
{
template.process(map, output);
output.flush();
}
catch (IOException ioEx)
{
throw new RuntimeException(ioEx);
}
catch (TemplateException templateEx)
{
throw new RuntimeException(templateEx);
}
return output.toString();
} | [
"public",
"static",
"String",
"processTemplate",
"(",
"Map",
"<",
"Object",
",",
"Object",
">",
"map",
",",
"Template",
"template",
")",
"{",
"Writer",
"output",
"=",
"new",
"StringWriter",
"(",
")",
";",
"try",
"{",
"template",
".",
"process",
"(",
"map... | Processes the provided data model with the specified Freemarker template
@param map the data model to use for template processing.
@param template The Freemarker {@link Template} to be processed.
@return The text output after successfully processing the template | [
"Processes",
"the",
"provided",
"data",
"model",
"with",
"the",
"specified",
"Freemarker",
"template"
] | train | https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/javaee/scaffold-faces/src/main/java/org/jboss/forge/addon/scaffold/faces/freemarker/FreemarkerTemplateProcessor.java#L80-L97 |
spring-projects/spring-data-solr | src/main/java/org/springframework/data/solr/core/query/Criteria.java | Criteria.near | public Criteria near(Box box) {
predicates.add(new Predicate(OperationKey.NEAR, new Object[] { box }));
return this;
} | java | public Criteria near(Box box) {
predicates.add(new Predicate(OperationKey.NEAR, new Object[] { box }));
return this;
} | [
"public",
"Criteria",
"near",
"(",
"Box",
"box",
")",
"{",
"predicates",
".",
"add",
"(",
"new",
"Predicate",
"(",
"OperationKey",
".",
"NEAR",
",",
"new",
"Object",
"[",
"]",
"{",
"box",
"}",
")",
")",
";",
"return",
"this",
";",
"}"
] | Creates new {@link Predicate} for {@code !bbox} with exact coordinates
@param box
@return | [
"Creates",
"new",
"{",
"@link",
"Predicate",
"}",
"for",
"{",
"@code",
"!bbox",
"}",
"with",
"exact",
"coordinates"
] | train | https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/query/Criteria.java#L527-L530 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/transform/TransformerRegistry.java | TransformerRegistry.addSubsystem | void addSubsystem(final OperationTransformerRegistry registry, final String name, final ModelVersion version) {
final OperationTransformerRegistry profile = registry.getChild(PathAddress.pathAddress(PROFILE));
final OperationTransformerRegistry server = registry.getChild(PathAddress.pathAddress(HOST, SERVER));
final PathAddress address = PathAddress.pathAddress(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, name));
subsystem.mergeSubtree(profile, Collections.singletonMap(address, version));
if(server != null) {
subsystem.mergeSubtree(server, Collections.singletonMap(address, version));
}
} | java | void addSubsystem(final OperationTransformerRegistry registry, final String name, final ModelVersion version) {
final OperationTransformerRegistry profile = registry.getChild(PathAddress.pathAddress(PROFILE));
final OperationTransformerRegistry server = registry.getChild(PathAddress.pathAddress(HOST, SERVER));
final PathAddress address = PathAddress.pathAddress(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, name));
subsystem.mergeSubtree(profile, Collections.singletonMap(address, version));
if(server != null) {
subsystem.mergeSubtree(server, Collections.singletonMap(address, version));
}
} | [
"void",
"addSubsystem",
"(",
"final",
"OperationTransformerRegistry",
"registry",
",",
"final",
"String",
"name",
",",
"final",
"ModelVersion",
"version",
")",
"{",
"final",
"OperationTransformerRegistry",
"profile",
"=",
"registry",
".",
"getChild",
"(",
"PathAddress... | Add a new subsystem to a given registry.
@param registry the registry
@param name the subsystem name
@param version the version | [
"Add",
"a",
"new",
"subsystem",
"to",
"a",
"given",
"registry",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/TransformerRegistry.java#L248-L256 |
blinkfox/zealot | src/main/java/com/blinkfox/zealot/core/ZealotKhala.java | ZealotKhala.notLike | public ZealotKhala notLike(String field, Object value) {
return this.doLike(ZealotConst.ONE_SPACE, field, value, true, false);
} | java | public ZealotKhala notLike(String field, Object value) {
return this.doLike(ZealotConst.ONE_SPACE, field, value, true, false);
} | [
"public",
"ZealotKhala",
"notLike",
"(",
"String",
"field",
",",
"Object",
"value",
")",
"{",
"return",
"this",
".",
"doLike",
"(",
"ZealotConst",
".",
"ONE_SPACE",
",",
"field",
",",
"value",
",",
"true",
",",
"false",
")",
";",
"}"
] | 生成" NOT LIKE "模糊查询的SQL片段.
<p>示例:传入 {"b.title", "Spring"} 两个参数,生成的SQL片段为:" b.title NOT LIKE ? ", SQL参数为:{"%Spring%"}</p>
@param field 数据库字段
@param value 值
@return ZealotKhala实例 | [
"生成",
"NOT",
"LIKE",
"模糊查询的SQL片段",
".",
"<p",
">",
"示例:传入",
"{",
"b",
".",
"title",
"Spring",
"}",
"两个参数,生成的SQL片段为:",
"b",
".",
"title",
"NOT",
"LIKE",
"?",
"SQL参数为",
":",
"{",
"%Spring%",
"}",
"<",
"/",
"p",
">"
] | train | https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/ZealotKhala.java#L965-L967 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/NetworkProfilesInner.java | NetworkProfilesInner.createOrUpdate | public NetworkProfileInner createOrUpdate(String resourceGroupName, String networkProfileName, NetworkProfileInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, networkProfileName, parameters).toBlocking().last().body();
} | java | public NetworkProfileInner createOrUpdate(String resourceGroupName, String networkProfileName, NetworkProfileInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, networkProfileName, parameters).toBlocking().last().body();
} | [
"public",
"NetworkProfileInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkProfileName",
",",
"NetworkProfileInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"networkProfileName... | Creates or updates a network profile.
@param resourceGroupName The name of the resource group.
@param networkProfileName The name of the network profile.
@param parameters Parameters supplied to the create or update network profile operation.
@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 NetworkProfileInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"network",
"profile",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/NetworkProfilesInner.java#L347-L349 |
wkgcass/Style | src/main/java/net/cassite/style/SwitchBlock.java | SwitchBlock.Case | public SwitchBlock<T, R> Case(T ca, R res) {
return Case(ca, () -> res);
} | java | public SwitchBlock<T, R> Case(T ca, R res) {
return Case(ca, () -> res);
} | [
"public",
"SwitchBlock",
"<",
"T",
",",
"R",
">",
"Case",
"(",
"T",
"ca",
",",
"R",
"res",
")",
"{",
"return",
"Case",
"(",
"ca",
",",
"(",
")",
"->",
"res",
")",
";",
"}"
] | add a Case block to the expression
@param ca the object for switch-expression to match
@param res an object for expression to return when matches.
@return <code>this</code> | [
"add",
"a",
"Case",
"block",
"to",
"the",
"expression"
] | train | https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/SwitchBlock.java#L53-L55 |
foundation-runtime/service-directory | 2.0/sd-core/src/main/java/com/cisco/oss/foundation/directory/Configurations.java | Configurations.getFloat | public static float getFloat(String name, float defaultVal){
if(getConfiguration().containsKey(name)){
return getConfiguration().getFloat(name);
} else {
return defaultVal;
}
} | java | public static float getFloat(String name, float defaultVal){
if(getConfiguration().containsKey(name)){
return getConfiguration().getFloat(name);
} else {
return defaultVal;
}
} | [
"public",
"static",
"float",
"getFloat",
"(",
"String",
"name",
",",
"float",
"defaultVal",
")",
"{",
"if",
"(",
"getConfiguration",
"(",
")",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"return",
"getConfiguration",
"(",
")",
".",
"getFloat",
"(",
"... | Get the property object as float, or return defaultVal if property is not defined.
@param name
property name.
@param defaultVal
default property value.
@return
property value as float, return defaultVal if property is undefined. | [
"Get",
"the",
"property",
"object",
"as",
"float",
"or",
"return",
"defaultVal",
"if",
"property",
"is",
"not",
"defined",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-core/src/main/java/com/cisco/oss/foundation/directory/Configurations.java#L200-L206 |
pac4j/pac4j | pac4j-config/src/main/java/org/pac4j/config/ldaptive/LdaptiveAuthenticatorBuilder.java | LdaptiveAuthenticatorBuilder.newSearchExecutor | public static SearchExecutor newSearchExecutor(final String baseDn, final String filterQuery, final String... params) {
final SearchExecutor executor = new SearchExecutor();
executor.setBaseDn(baseDn);
executor.setSearchFilter(newSearchFilter(filterQuery, params));
executor.setReturnAttributes(ReturnAttributes.ALL.value());
executor.setSearchScope(SearchScope.SUBTREE);
return executor;
} | java | public static SearchExecutor newSearchExecutor(final String baseDn, final String filterQuery, final String... params) {
final SearchExecutor executor = new SearchExecutor();
executor.setBaseDn(baseDn);
executor.setSearchFilter(newSearchFilter(filterQuery, params));
executor.setReturnAttributes(ReturnAttributes.ALL.value());
executor.setSearchScope(SearchScope.SUBTREE);
return executor;
} | [
"public",
"static",
"SearchExecutor",
"newSearchExecutor",
"(",
"final",
"String",
"baseDn",
",",
"final",
"String",
"filterQuery",
",",
"final",
"String",
"...",
"params",
")",
"{",
"final",
"SearchExecutor",
"executor",
"=",
"new",
"SearchExecutor",
"(",
")",
... | New search executor search executor.
@param baseDn the base dn
@param filterQuery the filter query
@param params the params
@return the search executor | [
"New",
"search",
"executor",
"search",
"executor",
"."
] | train | https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-config/src/main/java/org/pac4j/config/ldaptive/LdaptiveAuthenticatorBuilder.java#L389-L396 |
indeedeng/util | io/src/main/java/com/indeed/util/io/Files.java | Files.writeObjectToFile | @Deprecated
public static boolean writeObjectToFile(Object obj, String file) {
try {
writeObjectToFileOrDie(obj, file, LOGGER);
return true;
} catch (Exception e) {
LOGGER.error(e.getClass() + ": writeObjectToFile(" + file + ") encountered exception: " + e.getMessage(), e);
return false;
}
} | java | @Deprecated
public static boolean writeObjectToFile(Object obj, String file) {
try {
writeObjectToFileOrDie(obj, file, LOGGER);
return true;
} catch (Exception e) {
LOGGER.error(e.getClass() + ": writeObjectToFile(" + file + ") encountered exception: " + e.getMessage(), e);
return false;
}
} | [
"@",
"Deprecated",
"public",
"static",
"boolean",
"writeObjectToFile",
"(",
"Object",
"obj",
",",
"String",
"file",
")",
"{",
"try",
"{",
"writeObjectToFileOrDie",
"(",
"obj",
",",
"file",
",",
"LOGGER",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
... | Writes an object to a file.
@return true if the file was successfully written, false otherwise
@deprecated use {@link #writeObjectToFileOrDie(Object, String, org.apache.log4j.Logger)} instead | [
"Writes",
"an",
"object",
"to",
"a",
"file",
"."
] | train | https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/io/src/main/java/com/indeed/util/io/Files.java#L335-L344 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java | HtmlDocletWriter.addInlineDeprecatedComment | public void addInlineDeprecatedComment(Doc doc, Tag tag, Content htmltree) {
addCommentTags(doc, tag.inlineTags(), true, false, htmltree);
} | java | public void addInlineDeprecatedComment(Doc doc, Tag tag, Content htmltree) {
addCommentTags(doc, tag.inlineTags(), true, false, htmltree);
} | [
"public",
"void",
"addInlineDeprecatedComment",
"(",
"Doc",
"doc",
",",
"Tag",
"tag",
",",
"Content",
"htmltree",
")",
"{",
"addCommentTags",
"(",
"doc",
",",
"tag",
".",
"inlineTags",
"(",
")",
",",
"true",
",",
"false",
",",
"htmltree",
")",
";",
"}"
] | Add the inline deprecated comment.
@param doc the doc for which the inline deprecated comment will be added
@param tag the inline tag to be added
@param htmltree the content tree to which the comment will be added | [
"Add",
"the",
"inline",
"deprecated",
"comment",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java#L1430-L1432 |
assertthat/selenium-shutterbug | src/main/java/com/assertthat/selenium_shutterbug/core/Snapshot.java | Snapshot.withCroppedThumbnail | public T withCroppedThumbnail(double scale, int maxWidth, int maxHeight) {
return withCroppedThumbnail(Paths.get(location.toString(), "./thumbnails").toString(), "thumb_" + fileName, scale, maxWidth,maxHeight);
} | java | public T withCroppedThumbnail(double scale, int maxWidth, int maxHeight) {
return withCroppedThumbnail(Paths.get(location.toString(), "./thumbnails").toString(), "thumb_" + fileName, scale, maxWidth,maxHeight);
} | [
"public",
"T",
"withCroppedThumbnail",
"(",
"double",
"scale",
",",
"int",
"maxWidth",
",",
"int",
"maxHeight",
")",
"{",
"return",
"withCroppedThumbnail",
"(",
"Paths",
".",
"get",
"(",
"location",
".",
"toString",
"(",
")",
",",
"\"./thumbnails\"",
")",
".... | Generate cropped thumbnail of the original screenshot.
Will save different thumbnails depends on when it was called in the chain.
@param scale to apply
@param maxWidth max width in pixels. If set to -1 the actual image width is used
@param maxHeight max height in pixels. If set to -1 the actual image height is used
@return instance of type Snapshot | [
"Generate",
"cropped",
"thumbnail",
"of",
"the",
"original",
"screenshot",
".",
"Will",
"save",
"different",
"thumbnails",
"depends",
"on",
"when",
"it",
"was",
"called",
"in",
"the",
"chain",
"."
] | train | https://github.com/assertthat/selenium-shutterbug/blob/770d9b92423200d262c9ab70e40405921d81e262/src/main/java/com/assertthat/selenium_shutterbug/core/Snapshot.java#L145-L147 |
cpollet/jixture | core/src/main/java/net/cpollet/jixture/fixtures/generator/fixture/TemplateGenerator.java | TemplateGenerator.addFieldGenerator | public TemplateGenerator addFieldGenerator(String fieldName, FieldGenerator fieldGenerator) {
multiFieldGenerator.addFieldGenerator(fieldName, fieldGenerator);
return this;
} | java | public TemplateGenerator addFieldGenerator(String fieldName, FieldGenerator fieldGenerator) {
multiFieldGenerator.addFieldGenerator(fieldName, fieldGenerator);
return this;
} | [
"public",
"TemplateGenerator",
"addFieldGenerator",
"(",
"String",
"fieldName",
",",
"FieldGenerator",
"fieldGenerator",
")",
"{",
"multiFieldGenerator",
".",
"addFieldGenerator",
"(",
"fieldName",
",",
"fieldGenerator",
")",
";",
"return",
"this",
";",
"}"
] | Adds a {@link net.cpollet.jixture.fixtures.generator.field.FieldGenerator}.
@param fieldName the field's name whom value is to be overridden.
@param fieldGenerator the field generator to add
@return the current instance. | [
"Adds",
"a",
"{",
"@link",
"net",
".",
"cpollet",
".",
"jixture",
".",
"fixtures",
".",
"generator",
".",
"field",
".",
"FieldGenerator",
"}",
"."
] | train | https://github.com/cpollet/jixture/blob/faef0d4991f81c2cdb5be3ba24176636ef0cc433/core/src/main/java/net/cpollet/jixture/fixtures/generator/fixture/TemplateGenerator.java#L69-L72 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/internal/ExtensionFactory.java | ExtensionFactory.getExtensionDependency | public ExtensionDependency getExtensionDependency(String id, VersionConstraint versionConstraint, boolean optional,
Map<String, Object> properties)
{
return getExtensionDependency(new DefaultExtensionDependency(id, versionConstraint, optional, properties));
} | java | public ExtensionDependency getExtensionDependency(String id, VersionConstraint versionConstraint, boolean optional,
Map<String, Object> properties)
{
return getExtensionDependency(new DefaultExtensionDependency(id, versionConstraint, optional, properties));
} | [
"public",
"ExtensionDependency",
"getExtensionDependency",
"(",
"String",
"id",
",",
"VersionConstraint",
"versionConstraint",
",",
"boolean",
"optional",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"return",
"getExtensionDependency",
"(",
... | Store and return a weak reference equals to the passed {@link ExtensionDependency}.
@param id the id of the extension dependency
@param versionConstraint the version constraint of the extension dependency
@param optional true if the dependency is optional
@param properties the custom properties of the extension dependency
@return unique instance of {@link ExtensionDependency} equals to the passed one
@since 9.6RC1 | [
"Store",
"and",
"return",
"a",
"weak",
"reference",
"equals",
"to",
"the",
"passed",
"{",
"@link",
"ExtensionDependency",
"}",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/internal/ExtensionFactory.java#L86-L90 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/event/CheckRangeHandler.java | CheckRangeHandler.syncClonedListener | public boolean syncClonedListener(BaseField field, FieldListener listener, boolean bInitCalled)
{
if (!bInitCalled)
((CheckRangeHandler)listener).init(null, m_dStartRange, m_dEndRange);
return super.syncClonedListener(field, listener, true);
} | java | public boolean syncClonedListener(BaseField field, FieldListener listener, boolean bInitCalled)
{
if (!bInitCalled)
((CheckRangeHandler)listener).init(null, m_dStartRange, m_dEndRange);
return super.syncClonedListener(field, listener, true);
} | [
"public",
"boolean",
"syncClonedListener",
"(",
"BaseField",
"field",
",",
"FieldListener",
"listener",
",",
"boolean",
"bInitCalled",
")",
"{",
"if",
"(",
"!",
"bInitCalled",
")",
"(",
"(",
"CheckRangeHandler",
")",
"listener",
")",
".",
"init",
"(",
"null",
... | Set this cloned listener to the same state at this listener.
@param field The field this new listener will be added to.
@param The new listener to sync to this.
@param Has the init method been called?
@return True if I called init. | [
"Set",
"this",
"cloned",
"listener",
"to",
"the",
"same",
"state",
"at",
"this",
"listener",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/CheckRangeHandler.java#L99-L104 |
killbill/killbill | catalog/src/main/java/org/killbill/billing/catalog/DefaultVersionedCatalog.java | DefaultVersionedCatalog.getStaticCatalog | private StaticCatalog getStaticCatalog(final PlanSpecifier spec, final DateTime requestedDate, final DateTime subscriptionChangePlanDate) throws CatalogApiException {
final CatalogPlanEntry entry = findCatalogPlanEntry(new PlanRequestWrapper(spec), requestedDate, subscriptionChangePlanDate);
return entry.getStaticCatalog();
} | java | private StaticCatalog getStaticCatalog(final PlanSpecifier spec, final DateTime requestedDate, final DateTime subscriptionChangePlanDate) throws CatalogApiException {
final CatalogPlanEntry entry = findCatalogPlanEntry(new PlanRequestWrapper(spec), requestedDate, subscriptionChangePlanDate);
return entry.getStaticCatalog();
} | [
"private",
"StaticCatalog",
"getStaticCatalog",
"(",
"final",
"PlanSpecifier",
"spec",
",",
"final",
"DateTime",
"requestedDate",
",",
"final",
"DateTime",
"subscriptionChangePlanDate",
")",
"throws",
"CatalogApiException",
"{",
"final",
"CatalogPlanEntry",
"entry",
"=",
... | Note that the PlanSpecifier billing period must refer here to the recurring phase one when a plan name isn't specified | [
"Note",
"that",
"the",
"PlanSpecifier",
"billing",
"period",
"must",
"refer",
"here",
"to",
"the",
"recurring",
"phase",
"one",
"when",
"a",
"plan",
"name",
"isn",
"t",
"specified"
] | train | https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/catalog/src/main/java/org/killbill/billing/catalog/DefaultVersionedCatalog.java#L327-L330 |
VoltDB/voltdb | src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java | JDBC4DatabaseMetaData.supportsResultSetConcurrency | @Override
public boolean supportsResultSetConcurrency(int type, int concurrency) throws SQLException
{
checkClosed();
if (type == ResultSet.TYPE_SCROLL_INSENSITIVE && concurrency == ResultSet.CONCUR_READ_ONLY)
return true;
return false;
} | java | @Override
public boolean supportsResultSetConcurrency(int type, int concurrency) throws SQLException
{
checkClosed();
if (type == ResultSet.TYPE_SCROLL_INSENSITIVE && concurrency == ResultSet.CONCUR_READ_ONLY)
return true;
return false;
} | [
"@",
"Override",
"public",
"boolean",
"supportsResultSetConcurrency",
"(",
"int",
"type",
",",
"int",
"concurrency",
")",
"throws",
"SQLException",
"{",
"checkClosed",
"(",
")",
";",
"if",
"(",
"type",
"==",
"ResultSet",
".",
"TYPE_SCROLL_INSENSITIVE",
"&&",
"co... | Retrieves whether this database supports the given concurrency type in combination with the given result set type. | [
"Retrieves",
"whether",
"this",
"database",
"supports",
"the",
"given",
"concurrency",
"type",
"in",
"combination",
"with",
"the",
"given",
"result",
"set",
"type",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java#L1497-L1504 |
meertensinstituut/mtas | src/main/java/mtas/solr/handler/component/util/MtasSolrCollectionResult.java | MtasSolrCollectionResult.setCheck | public void setCheck(long now, SimpleOrderedMap<Object> status)
throws IOException {
if (action.equals(ComponentCollection.ACTION_CHECK)) {
this.now = now;
this.status = status;
} else {
throw new IOException("not allowed with action '" + action + "'");
}
} | java | public void setCheck(long now, SimpleOrderedMap<Object> status)
throws IOException {
if (action.equals(ComponentCollection.ACTION_CHECK)) {
this.now = now;
this.status = status;
} else {
throw new IOException("not allowed with action '" + action + "'");
}
} | [
"public",
"void",
"setCheck",
"(",
"long",
"now",
",",
"SimpleOrderedMap",
"<",
"Object",
">",
"status",
")",
"throws",
"IOException",
"{",
"if",
"(",
"action",
".",
"equals",
"(",
"ComponentCollection",
".",
"ACTION_CHECK",
")",
")",
"{",
"this",
".",
"no... | Sets the check.
@param now the now
@param status the status
@throws IOException Signals that an I/O exception has occurred. | [
"Sets",
"the",
"check",
"."
] | train | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/solr/handler/component/util/MtasSolrCollectionResult.java#L111-L119 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.