repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Reductions.java | Reductions.reduce | public static <E, R> R reduce(E[] array, BiFunction<R, E, R> function, R init) {
return new Reductor<>(function, init).apply(new ArrayIterator<E>(array));
} | java | public static <E, R> R reduce(E[] array, BiFunction<R, E, R> function, R init) {
return new Reductor<>(function, init).apply(new ArrayIterator<E>(array));
} | [
"public",
"static",
"<",
"E",
",",
"R",
">",
"R",
"reduce",
"(",
"E",
"[",
"]",
"array",
",",
"BiFunction",
"<",
"R",
",",
"E",
",",
"R",
">",
"function",
",",
"R",
"init",
")",
"{",
"return",
"new",
"Reductor",
"<>",
"(",
"function",
",",
"ini... | Reduces an array of elements using the passed function.
@param <E> the element type parameter
@param <R> the result type parameter
@param array the array to be consumed
@param function the reduction function
@param init the initial value for reductions
@return the reduced value | [
"Reduces",
"an",
"array",
"of",
"elements",
"using",
"the",
"passed",
"function",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Reductions.java#L62-L64 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Reductions.java | Reductions.every | public static <E> boolean every(Iterable<E> iterable, Predicate<E> predicate) {
dbc.precondition(iterable != null, "cannot call every with a null iterable");
return new Every<E>(predicate).test(iterable.iterator());
} | java | public static <E> boolean every(Iterable<E> iterable, Predicate<E> predicate) {
dbc.precondition(iterable != null, "cannot call every with a null iterable");
return new Every<E>(predicate).test(iterable.iterator());
} | [
"public",
"static",
"<",
"E",
">",
"boolean",
"every",
"(",
"Iterable",
"<",
"E",
">",
"iterable",
",",
"Predicate",
"<",
"E",
">",
"predicate",
")",
"{",
"dbc",
".",
"precondition",
"(",
"iterable",
"!=",
"null",
",",
"\"cannot call every with a null iterab... | Yields true if EVERY predicate application on the given iterable yields
true.
@param <E> the iterable element type parameter
@param iterable the iterable where elements are fetched from
@param predicate the predicate applied to every element fetched from the
iterable
@return true if EVERY predicate application yields true | [
"Yields",
"true",
"if",
"EVERY",
"predicate",
"application",
"on",
"the",
"given",
"iterable",
"yields",
"true",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Reductions.java#L122-L125 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Reductions.java | Reductions.every | public static <E> boolean every(Iterator<E> iterator, Predicate<E> predicate) {
return new Every<E>(predicate).test(iterator);
} | java | public static <E> boolean every(Iterator<E> iterator, Predicate<E> predicate) {
return new Every<E>(predicate).test(iterator);
} | [
"public",
"static",
"<",
"E",
">",
"boolean",
"every",
"(",
"Iterator",
"<",
"E",
">",
"iterator",
",",
"Predicate",
"<",
"E",
">",
"predicate",
")",
"{",
"return",
"new",
"Every",
"<",
"E",
">",
"(",
"predicate",
")",
".",
"test",
"(",
"iterator",
... | Yields true if EVERY predicate application on the given iterator yields
true.
@param <E> the iterator element type parameter
@param iterator the iterator where elements are fetched from
@param predicate the predicate applied to every element fetched from the
iterator
@return true if EVERY predicate application yields true | [
"Yields",
"true",
"if",
"EVERY",
"predicate",
"application",
"on",
"the",
"given",
"iterator",
"yields",
"true",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Reductions.java#L137-L139 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Reductions.java | Reductions.every | public static <E> boolean every(E[] array, Predicate<E> predicate) {
return new Every<E>(predicate).test(new ArrayIterator<E>(array));
} | java | public static <E> boolean every(E[] array, Predicate<E> predicate) {
return new Every<E>(predicate).test(new ArrayIterator<E>(array));
} | [
"public",
"static",
"<",
"E",
">",
"boolean",
"every",
"(",
"E",
"[",
"]",
"array",
",",
"Predicate",
"<",
"E",
">",
"predicate",
")",
"{",
"return",
"new",
"Every",
"<",
"E",
">",
"(",
"predicate",
")",
".",
"test",
"(",
"new",
"ArrayIterator",
"<... | Yields true if EVERY predicate application on the given array yields
true.
@param <E> the array element type parameter
@param array the array where elements are fetched from
@param predicate the predicate applied to every element fetched from the
array
@return true if EVERY predicate application yields true | [
"Yields",
"true",
"if",
"EVERY",
"predicate",
"application",
"on",
"the",
"given",
"array",
"yields",
"true",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Reductions.java#L151-L153 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Reductions.java | Reductions.counti | public static <E> int counti(Iterator<E> iterator) {
final long value = reduce(iterator, new Count<E>(), 0l);
dbc.state(value <= Integer.MAX_VALUE, "iterator size overflows an integer");
return (int) value;
} | java | public static <E> int counti(Iterator<E> iterator) {
final long value = reduce(iterator, new Count<E>(), 0l);
dbc.state(value <= Integer.MAX_VALUE, "iterator size overflows an integer");
return (int) value;
} | [
"public",
"static",
"<",
"E",
">",
"int",
"counti",
"(",
"Iterator",
"<",
"E",
">",
"iterator",
")",
"{",
"final",
"long",
"value",
"=",
"reduce",
"(",
"iterator",
",",
"new",
"Count",
"<",
"E",
">",
"(",
")",
",",
"0l",
")",
";",
"dbc",
".",
"... | Counts elements contained in the iterator.
@param <E> the iterator element type parameter
@param iterator the iterator to be consumed
@return the size of the iterator | [
"Counts",
"elements",
"contained",
"in",
"the",
"iterator",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Reductions.java#L185-L189 | train |
hdbeukel/james-extensions | src/main/java/org/jamesframework/ext/analysis/SearchRunResults.java | SearchRunResults.updateBestSolution | public void updateBestSolution(long time, double value, SolutionType newBestSolution){
times.add(time);
values.add(value);
bestSolution = newBestSolution;
} | java | public void updateBestSolution(long time, double value, SolutionType newBestSolution){
times.add(time);
values.add(value);
bestSolution = newBestSolution;
} | [
"public",
"void",
"updateBestSolution",
"(",
"long",
"time",
",",
"double",
"value",
",",
"SolutionType",
"newBestSolution",
")",
"{",
"times",
".",
"add",
"(",
"time",
")",
";",
"values",
".",
"add",
"(",
"value",
")",
";",
"bestSolution",
"=",
"newBestSo... | Update the best found solution. The update time and newly obtained value are added
to the list of updates and the final best solution is overwritten.
@param time time at which the solution was found (milliseconds)
@param value value of the solution
@param newBestSolution newly found best solution | [
"Update",
"the",
"best",
"found",
"solution",
".",
"The",
"update",
"time",
"and",
"newly",
"obtained",
"value",
"are",
"added",
"to",
"the",
"list",
"of",
"updates",
"and",
"the",
"final",
"best",
"solution",
"is",
"overwritten",
"."
] | 37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2 | https://github.com/hdbeukel/james-extensions/blob/37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2/src/main/java/org/jamesframework/ext/analysis/SearchRunResults.java#L75-L79 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Tuples.java | Tuples.tupled | public static <T, U, R> Function<Pair<T, U>, R> tupled(BiFunction<T, U, R> function) {
dbc.precondition(function != null, "cannot apply a pair to a null function");
return pair -> function.apply(pair.first(), pair.second());
} | java | public static <T, U, R> Function<Pair<T, U>, R> tupled(BiFunction<T, U, R> function) {
dbc.precondition(function != null, "cannot apply a pair to a null function");
return pair -> function.apply(pair.first(), pair.second());
} | [
"public",
"static",
"<",
"T",
",",
"U",
",",
"R",
">",
"Function",
"<",
"Pair",
"<",
"T",
",",
"U",
">",
",",
"R",
">",
"tupled",
"(",
"BiFunction",
"<",
"T",
",",
"U",
",",
"R",
">",
"function",
")",
"{",
"dbc",
".",
"precondition",
"(",
"fu... | Adapts a binary function to a function accepting a pair.
@param <T> the function first parameter type
@param <U> the function second parameter type
@param <R> the function return type
@param function the function to be adapted
@return the adapted function | [
"Adapts",
"a",
"binary",
"function",
"to",
"a",
"function",
"accepting",
"a",
"pair",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Tuples.java#L31-L34 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Tuples.java | Tuples.tupled | public static <T, U> Predicate<Pair<T, U>> tupled(BiPredicate<T, U> predicate) {
dbc.precondition(predicate != null, "cannot apply a pair to a null predicate");
return pair -> predicate.test(pair.first(), pair.second());
} | java | public static <T, U> Predicate<Pair<T, U>> tupled(BiPredicate<T, U> predicate) {
dbc.precondition(predicate != null, "cannot apply a pair to a null predicate");
return pair -> predicate.test(pair.first(), pair.second());
} | [
"public",
"static",
"<",
"T",
",",
"U",
">",
"Predicate",
"<",
"Pair",
"<",
"T",
",",
"U",
">",
">",
"tupled",
"(",
"BiPredicate",
"<",
"T",
",",
"U",
">",
"predicate",
")",
"{",
"dbc",
".",
"precondition",
"(",
"predicate",
"!=",
"null",
",",
"\... | Adapts a binary predicate to a predicate accepting a pair.
@param <T> the predicate first parameter type
@param <U> the predicate second parameter type
@param predicate the predicate to be adapted
@return the adapted predicate | [
"Adapts",
"a",
"binary",
"predicate",
"to",
"a",
"predicate",
"accepting",
"a",
"pair",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Tuples.java#L44-L47 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Tuples.java | Tuples.tupled | public static <T, U> Consumer<Pair<T, U>> tupled(BiConsumer<T, U> consumer) {
dbc.precondition(consumer != null, "cannot apply a pair to a null consumer");
return pair -> consumer.accept(pair.first(), pair.second());
} | java | public static <T, U> Consumer<Pair<T, U>> tupled(BiConsumer<T, U> consumer) {
dbc.precondition(consumer != null, "cannot apply a pair to a null consumer");
return pair -> consumer.accept(pair.first(), pair.second());
} | [
"public",
"static",
"<",
"T",
",",
"U",
">",
"Consumer",
"<",
"Pair",
"<",
"T",
",",
"U",
">",
">",
"tupled",
"(",
"BiConsumer",
"<",
"T",
",",
"U",
">",
"consumer",
")",
"{",
"dbc",
".",
"precondition",
"(",
"consumer",
"!=",
"null",
",",
"\"can... | Adapts a binary consumer to an consumer accepting a pair.
@param <T> the consumer first parameter type
@param <U> the consumer second parameter type
@param consumer the consumer to be adapted
@return the adapted consumer | [
"Adapts",
"a",
"binary",
"consumer",
"to",
"an",
"consumer",
"accepting",
"a",
"pair",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Tuples.java#L57-L60 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Tuples.java | Tuples.tupled | public static <T, U, V, R> Function<Triple<T, U, V>, R> tupled(TriFunction<T, U, V, R> function) {
dbc.precondition(function != null, "cannot apply a triple to a null function");
return triple -> function.apply(triple.first(), triple.second(), triple.third());
} | java | public static <T, U, V, R> Function<Triple<T, U, V>, R> tupled(TriFunction<T, U, V, R> function) {
dbc.precondition(function != null, "cannot apply a triple to a null function");
return triple -> function.apply(triple.first(), triple.second(), triple.third());
} | [
"public",
"static",
"<",
"T",
",",
"U",
",",
"V",
",",
"R",
">",
"Function",
"<",
"Triple",
"<",
"T",
",",
"U",
",",
"V",
">",
",",
"R",
">",
"tupled",
"(",
"TriFunction",
"<",
"T",
",",
"U",
",",
"V",
",",
"R",
">",
"function",
")",
"{",
... | Adapts a ternary function to a function accepting a triple.
@param <T> the function first parameter type
@param <U> the function second parameter type
@param <V> the function third parameter type
@param <R> the function return type
@param function the function to be adapted
@return the adapted function | [
"Adapts",
"a",
"ternary",
"function",
"to",
"a",
"function",
"accepting",
"a",
"triple",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Tuples.java#L72-L75 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Tuples.java | Tuples.tupled | public static <T, U, V> Predicate<Triple<T, U, V>> tupled(TriPredicate<T, U, V> predicate) {
dbc.precondition(predicate != null, "cannot apply a triple to a null predicate");
return triple -> predicate.test(triple.first(), triple.second(), triple.third());
} | java | public static <T, U, V> Predicate<Triple<T, U, V>> tupled(TriPredicate<T, U, V> predicate) {
dbc.precondition(predicate != null, "cannot apply a triple to a null predicate");
return triple -> predicate.test(triple.first(), triple.second(), triple.third());
} | [
"public",
"static",
"<",
"T",
",",
"U",
",",
"V",
">",
"Predicate",
"<",
"Triple",
"<",
"T",
",",
"U",
",",
"V",
">",
">",
"tupled",
"(",
"TriPredicate",
"<",
"T",
",",
"U",
",",
"V",
">",
"predicate",
")",
"{",
"dbc",
".",
"precondition",
"(",... | Adapts a ternary predicate to a predicate accepting a triple.
@param <T> the predicate first parameter type
@param <U> the predicate second parameter type
@param <V> the predicate third parameter type
@param predicate the predicate to be adapted
@return the adapted predicate | [
"Adapts",
"a",
"ternary",
"predicate",
"to",
"a",
"predicate",
"accepting",
"a",
"triple",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Tuples.java#L86-L89 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Tuples.java | Tuples.tupled | public static <T, U, V> Consumer<Triple<T, U, V>> tupled(TriConsumer<T, U, V> consumer) {
dbc.precondition(consumer != null, "cannot apply a triple to a null consumer");
return triple -> consumer.accept(triple.first(), triple.second(), triple.third());
} | java | public static <T, U, V> Consumer<Triple<T, U, V>> tupled(TriConsumer<T, U, V> consumer) {
dbc.precondition(consumer != null, "cannot apply a triple to a null consumer");
return triple -> consumer.accept(triple.first(), triple.second(), triple.third());
} | [
"public",
"static",
"<",
"T",
",",
"U",
",",
"V",
">",
"Consumer",
"<",
"Triple",
"<",
"T",
",",
"U",
",",
"V",
">",
">",
"tupled",
"(",
"TriConsumer",
"<",
"T",
",",
"U",
",",
"V",
">",
"consumer",
")",
"{",
"dbc",
".",
"precondition",
"(",
... | Adapts a ternary consumer to an consumer accepting a triple.
@param <T> the consumer first parameter type
@param <U> the consumer second parameter type
@param <V> the consumer third parameter type
@param consumer the consumer to be adapted
@return the adatped consumer | [
"Adapts",
"a",
"ternary",
"consumer",
"to",
"an",
"consumer",
"accepting",
"a",
"triple",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Tuples.java#L100-L103 | train |
forge/javaee-descriptors | impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/connector16/ConnectorDescriptorImpl.java | ConnectorDescriptorImpl.removeAllNamespaces | public ConnectorDescriptor removeAllNamespaces()
{
List<String> nameSpaceKeys = new ArrayList<String>();
java.util.Map<String, String> attributes = model.getAttributes();
for (Entry<String, String> e : attributes.entrySet())
{
final String name = e.getKey();
final String value = e.getValue();
if (value != null && value.startsWith("http://"))
{
nameSpaceKeys.add(name);
}
}
for (String name: nameSpaceKeys)
{
model.removeAttribute(name);
}
return this;
} | java | public ConnectorDescriptor removeAllNamespaces()
{
List<String> nameSpaceKeys = new ArrayList<String>();
java.util.Map<String, String> attributes = model.getAttributes();
for (Entry<String, String> e : attributes.entrySet())
{
final String name = e.getKey();
final String value = e.getValue();
if (value != null && value.startsWith("http://"))
{
nameSpaceKeys.add(name);
}
}
for (String name: nameSpaceKeys)
{
model.removeAttribute(name);
}
return this;
} | [
"public",
"ConnectorDescriptor",
"removeAllNamespaces",
"(",
")",
"{",
"List",
"<",
"String",
">",
"nameSpaceKeys",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"attributes"... | Removes all existing namespaces.
@return the current instance of <code>ConnectorDescriptor</code> | [
"Removes",
"all",
"existing",
"namespaces",
"."
] | cb914330a1a0b04bfc1d0f199bd9cde3bbf0b3ed | https://github.com/forge/javaee-descriptors/blob/cb914330a1a0b04bfc1d0f199bd9cde3bbf0b3ed/impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/connector16/ConnectorDescriptorImpl.java#L117-L135 | train |
DaGeRe/KoPeMe | kopeme-analysis/src/main/java/de/dagere/kopeme/instrumentation/KoPeMeClassFileTransformater.java | KoPeMeClassFileTransformater.around | private void around(final CtMethod m, final String before, final String after, final List<VarDeclarationData> declarations) throws CannotCompileException, NotFoundException {
String signature = Modifier.toString(m.getModifiers()) + " " + m.getReturnType().getName() + " " + m.getLongName();
LOG.info("--- Instrumenting " + signature);
for (VarDeclarationData declaration : declarations) {
m.addLocalVariable(declaration.getName(), pool.get(declaration.getType()));
}
m.insertBefore(before);
m.insertAfter(after);
} | java | private void around(final CtMethod m, final String before, final String after, final List<VarDeclarationData> declarations) throws CannotCompileException, NotFoundException {
String signature = Modifier.toString(m.getModifiers()) + " " + m.getReturnType().getName() + " " + m.getLongName();
LOG.info("--- Instrumenting " + signature);
for (VarDeclarationData declaration : declarations) {
m.addLocalVariable(declaration.getName(), pool.get(declaration.getType()));
}
m.insertBefore(before);
m.insertAfter(after);
} | [
"private",
"void",
"around",
"(",
"final",
"CtMethod",
"m",
",",
"final",
"String",
"before",
",",
"final",
"String",
"after",
",",
"final",
"List",
"<",
"VarDeclarationData",
">",
"declarations",
")",
"throws",
"CannotCompileException",
",",
"NotFoundException",
... | Method introducing code before and after a given javassist method.
@param m
@param before
@param after
@throws CannotCompileException
@throws NotFoundException | [
"Method",
"introducing",
"code",
"before",
"and",
"after",
"a",
"given",
"javassist",
"method",
"."
] | a4939113cba73cb20a2c7d6dc8d34d0139a3e340 | https://github.com/DaGeRe/KoPeMe/blob/a4939113cba73cb20a2c7d6dc8d34d0139a3e340/kopeme-analysis/src/main/java/de/dagere/kopeme/instrumentation/KoPeMeClassFileTransformater.java#L82-L90 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Iterations.java | Iterations.oneTime | public static <T> Iterable<T> oneTime(Iterator<T> iterator) {
return new OneTimeIterable<T>(iterator);
} | java | public static <T> Iterable<T> oneTime(Iterator<T> iterator) {
return new OneTimeIterable<T>(iterator);
} | [
"public",
"static",
"<",
"T",
">",
"Iterable",
"<",
"T",
">",
"oneTime",
"(",
"Iterator",
"<",
"T",
">",
"iterator",
")",
"{",
"return",
"new",
"OneTimeIterable",
"<",
"T",
">",
"(",
"iterator",
")",
";",
"}"
] | Creates an iterable usable only ONE TIME from an iterator.
@param <T> the iterator element type parameter
@param iterator the iterator to be yielded by the iterable
@return an iterable consumable only once | [
"Creates",
"an",
"iterable",
"usable",
"only",
"ONE",
"TIME",
"from",
"an",
"iterator",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Iterations.java#L24-L26 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Iterations.java | Iterations.iterator | public static <T> Iterator<T> iterator(T first, T second) {
return ArrayIterator.of(first, second);
} | java | public static <T> Iterator<T> iterator(T first, T second) {
return ArrayIterator.of(first, second);
} | [
"public",
"static",
"<",
"T",
">",
"Iterator",
"<",
"T",
">",
"iterator",
"(",
"T",
"first",
",",
"T",
"second",
")",
"{",
"return",
"ArrayIterator",
".",
"of",
"(",
"first",
",",
"second",
")",
";",
"}"
] | Creates an iterator from the passed values.
@param <T> the elements parameter type
@param first the first element
@param second the second element
@return an iterator. | [
"Creates",
"an",
"iterator",
"from",
"the",
"passed",
"values",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Iterations.java#L54-L56 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Iterations.java | Iterations.iterable | public static <T> Iterable<T> iterable(T first, T second) {
return ArrayIterable.of(first, second);
} | java | public static <T> Iterable<T> iterable(T first, T second) {
return ArrayIterable.of(first, second);
} | [
"public",
"static",
"<",
"T",
">",
"Iterable",
"<",
"T",
">",
"iterable",
"(",
"T",
"first",
",",
"T",
"second",
")",
"{",
"return",
"ArrayIterable",
".",
"of",
"(",
"first",
",",
"second",
")",
";",
"}"
] | Creates an iterable from the passed values.
@param <T> the elements parameter type
@param first the first element
@param second the second element
@return an iterable. | [
"Creates",
"an",
"iterable",
"from",
"the",
"passed",
"values",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Iterations.java#L106-L108 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/interceptions/BinaryInterceptorAdapter.java | BinaryInterceptorAdapter.apply | @Override
public R apply(T1 first, T2 second) {
interceptor.before(first, second);
try {
return inner.apply(first, second);
} finally {
interceptor.after(first, second);
}
} | java | @Override
public R apply(T1 first, T2 second) {
interceptor.before(first, second);
try {
return inner.apply(first, second);
} finally {
interceptor.after(first, second);
}
} | [
"@",
"Override",
"public",
"R",
"apply",
"(",
"T1",
"first",
",",
"T2",
"second",
")",
"{",
"interceptor",
".",
"before",
"(",
"first",
",",
"second",
")",
";",
"try",
"{",
"return",
"inner",
".",
"apply",
"(",
"first",
",",
"second",
")",
";",
"}"... | Executes a function in the nested interceptor context.
@param first
@param second
@return the result of the inner function | [
"Executes",
"a",
"function",
"in",
"the",
"nested",
"interceptor",
"context",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/interceptions/BinaryInterceptorAdapter.java#L33-L41 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/bank/BLZ.java | BLZ.validate | @Deprecated
public static String validate(String blz) {
return VALIDATOR.validate(PackedDecimal.of(blz)).toString();
} | java | @Deprecated
public static String validate(String blz) {
return VALIDATOR.validate(PackedDecimal.of(blz)).toString();
} | [
"@",
"Deprecated",
"public",
"static",
"String",
"validate",
"(",
"String",
"blz",
")",
"{",
"return",
"VALIDATOR",
".",
"validate",
"(",
"PackedDecimal",
".",
"of",
"(",
"blz",
")",
")",
".",
"toString",
"(",
")",
";",
"}"
] | Eine BLZ darf maximal 8-stellig sein.
@param blz die Bankleitzahl
@return die Bankleitzahl zur Weiterverabeitung
@deprecated bitte {@link Validator#validate(String)} verwenden | [
"Eine",
"BLZ",
"darf",
"maximal",
"8",
"-",
"stellig",
"sein",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/bank/BLZ.java#L98-L101 | train |
hdbeukel/james-extensions | src/main/java/org/jamesframework/ext/problems/objectives/WeightedIndex.java | WeightedIndex.evaluate | @Override
public WeightedIndexEvaluation evaluate(SolutionType solution, DataType data) {
// initialize evaluation object
WeightedIndexEvaluation eval = new WeightedIndexEvaluation();
// add evaluations produced by contained objectives
weights.keySet().forEach(obj -> {
// evaluate solution using objective
Evaluation objEval = obj.evaluate(solution, data);
// flip weight sign if minimizing
double w = weights.get(obj);
if(obj.isMinimizing()){
w = -w;
}
// register in weighted index evaluation
eval.addEvaluation(obj, objEval, w);
});
// return weighted index evaluation
return eval;
} | java | @Override
public WeightedIndexEvaluation evaluate(SolutionType solution, DataType data) {
// initialize evaluation object
WeightedIndexEvaluation eval = new WeightedIndexEvaluation();
// add evaluations produced by contained objectives
weights.keySet().forEach(obj -> {
// evaluate solution using objective
Evaluation objEval = obj.evaluate(solution, data);
// flip weight sign if minimizing
double w = weights.get(obj);
if(obj.isMinimizing()){
w = -w;
}
// register in weighted index evaluation
eval.addEvaluation(obj, objEval, w);
});
// return weighted index evaluation
return eval;
} | [
"@",
"Override",
"public",
"WeightedIndexEvaluation",
"evaluate",
"(",
"SolutionType",
"solution",
",",
"DataType",
"data",
")",
"{",
"// initialize evaluation object",
"WeightedIndexEvaluation",
"eval",
"=",
"new",
"WeightedIndexEvaluation",
"(",
")",
";",
"// add evalua... | Produces an evaluation object that reflects the weighted sum of evaluations of all underlying objectives.
@param solution solution to evaluate
@param data data to be used for evaluation
@return weighted index evaluation | [
"Produces",
"an",
"evaluation",
"object",
"that",
"reflects",
"the",
"weighted",
"sum",
"of",
"evaluations",
"of",
"all",
"underlying",
"objectives",
"."
] | 37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2 | https://github.com/hdbeukel/james-extensions/blob/37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2/src/main/java/org/jamesframework/ext/problems/objectives/WeightedIndex.java#L102-L120 | train |
hdbeukel/james-extensions | src/main/java/org/jamesframework/ext/problems/objectives/WeightedIndex.java | WeightedIndex.evaluate | @Override
public <ActualSolutionType extends SolutionType> WeightedIndexEvaluation evaluate(Move<? super ActualSolutionType> move,
ActualSolutionType curSolution,
Evaluation curEvaluation,
DataType data) {
// cast current evaluation object
WeightedIndexEvaluation curEval = (WeightedIndexEvaluation) curEvaluation;
// initialize new evaluation object
WeightedIndexEvaluation newEval = new WeightedIndexEvaluation();
// compute delta evaluation for each contained objective
weights.keySet().forEach(obj -> {
// extract current evaluation
Evaluation objCurEval = curEval.getEvaluation(obj);
// delta evaluation of contained objective
Evaluation objNewEval = obj.evaluate(move, curSolution, objCurEval, data);
// flip weight sign if minimizing
double w = weights.get(obj);
if(obj.isMinimizing()){
w = -w;
}
// register in new weighted index evaluation
newEval.addEvaluation(obj, objNewEval, w);
});
// return new evaluation
return newEval;
} | java | @Override
public <ActualSolutionType extends SolutionType> WeightedIndexEvaluation evaluate(Move<? super ActualSolutionType> move,
ActualSolutionType curSolution,
Evaluation curEvaluation,
DataType data) {
// cast current evaluation object
WeightedIndexEvaluation curEval = (WeightedIndexEvaluation) curEvaluation;
// initialize new evaluation object
WeightedIndexEvaluation newEval = new WeightedIndexEvaluation();
// compute delta evaluation for each contained objective
weights.keySet().forEach(obj -> {
// extract current evaluation
Evaluation objCurEval = curEval.getEvaluation(obj);
// delta evaluation of contained objective
Evaluation objNewEval = obj.evaluate(move, curSolution, objCurEval, data);
// flip weight sign if minimizing
double w = weights.get(obj);
if(obj.isMinimizing()){
w = -w;
}
// register in new weighted index evaluation
newEval.addEvaluation(obj, objNewEval, w);
});
// return new evaluation
return newEval;
} | [
"@",
"Override",
"public",
"<",
"ActualSolutionType",
"extends",
"SolutionType",
">",
"WeightedIndexEvaluation",
"evaluate",
"(",
"Move",
"<",
"?",
"super",
"ActualSolutionType",
">",
"move",
",",
"ActualSolutionType",
"curSolution",
",",
"Evaluation",
"curEvaluation",
... | Delta evaluation. Computes a delta evaluation for each contained objective and wraps
the obtained modified evaluations in a new weighted index evaluation.
@param move move to be evaluated
@param curSolution current solution of a local search
@param curEvaluation evaluation of current solution
@param data data to be used for evaluation
@param <ActualSolutionType> the actual solution type of the problem that is being solved;
a subtype of the solution types of both the objective and the applied move
@return weighted index evaluation of obtained neighbour when applying the move | [
"Delta",
"evaluation",
".",
"Computes",
"a",
"delta",
"evaluation",
"for",
"each",
"contained",
"objective",
"and",
"wraps",
"the",
"obtained",
"modified",
"evaluations",
"in",
"a",
"new",
"weighted",
"index",
"evaluation",
"."
] | 37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2 | https://github.com/hdbeukel/james-extensions/blob/37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2/src/main/java/org/jamesframework/ext/problems/objectives/WeightedIndex.java#L134-L159 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/util/ToFachwertSerializer.java | ToFachwertSerializer.serialize | @Override
public void serialize(Fachwert fachwert, JsonGenerator jgen, SerializerProvider provider) throws IOException {
serialize(fachwert.toMap(), jgen, provider);
} | java | @Override
public void serialize(Fachwert fachwert, JsonGenerator jgen, SerializerProvider provider) throws IOException {
serialize(fachwert.toMap(), jgen, provider);
} | [
"@",
"Override",
"public",
"void",
"serialize",
"(",
"Fachwert",
"fachwert",
",",
"JsonGenerator",
"jgen",
",",
"SerializerProvider",
"provider",
")",
"throws",
"IOException",
"{",
"serialize",
"(",
"fachwert",
".",
"toMap",
"(",
")",
",",
"jgen",
",",
"provid... | Fuer die Serialisierung wird der uebergebenen Fachwert nach seinen
einzelnen Elementen aufgeteilt und serialisiert.
@param fachwert Fachwert
@param jgen Json-Generator
@param provider Provider
@throws IOException sollte nicht auftreten | [
"Fuer",
"die",
"Serialisierung",
"wird",
"der",
"uebergebenen",
"Fachwert",
"nach",
"seinen",
"einzelnen",
"Elementen",
"aufgeteilt",
"und",
"serialisiert",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/util/ToFachwertSerializer.java#L59-L62 | train |
davidcarboni/restolino | src/main/java/com/github/davidcarboni/restolino/Configuration.java | Configuration.configurePort | void configurePort(String port) {
if (StringUtils.isNotBlank(port)) {
try {
this.port = Integer.parseInt(port);
log.info("Using port {}", this.port);
} catch (NumberFormatException e) {
log.info("Unable to parse server PORT variable ({}). Defaulting to port {}", port, this.port);
}
}
} | java | void configurePort(String port) {
if (StringUtils.isNotBlank(port)) {
try {
this.port = Integer.parseInt(port);
log.info("Using port {}", this.port);
} catch (NumberFormatException e) {
log.info("Unable to parse server PORT variable ({}). Defaulting to port {}", port, this.port);
}
}
} | [
"void",
"configurePort",
"(",
"String",
"port",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"port",
")",
")",
"{",
"try",
"{",
"this",
".",
"port",
"=",
"Integer",
".",
"parseInt",
"(",
"port",
")",
";",
"log",
".",
"info",
"(",
"\"... | Configures the server port by attempting to parse the given parameter,
but failing gracefully if that doesn't work out.
@param port The value of the {@value #PORT} parameter. | [
"Configures",
"the",
"server",
"port",
"by",
"attempting",
"to",
"parse",
"the",
"given",
"parameter",
"but",
"failing",
"gracefully",
"if",
"that",
"doesn",
"t",
"work",
"out",
"."
] | 3f84ece1bd016fbb597c624d46fcca5a2580a33d | https://github.com/davidcarboni/restolino/blob/3f84ece1bd016fbb597c624d46fcca5a2580a33d/src/main/java/com/github/davidcarboni/restolino/Configuration.java#L170-L180 | train |
davidcarboni/restolino | src/main/java/com/github/davidcarboni/restolino/Configuration.java | Configuration.configureClasses | void configureClasses(String path) {
findClassesInClasspath();
if (StringUtils.isNotBlank(path)) {
// If the path is set, set up class reloading:
configureClassesReloadable(path);
}
packagePrefix = getValue(PACKAGE_PREFIX);
classesReloadable = classesUrl != null && classesInClasspath == null;
// Communicate:
showClassesConfiguration();
} | java | void configureClasses(String path) {
findClassesInClasspath();
if (StringUtils.isNotBlank(path)) {
// If the path is set, set up class reloading:
configureClassesReloadable(path);
}
packagePrefix = getValue(PACKAGE_PREFIX);
classesReloadable = classesUrl != null && classesInClasspath == null;
// Communicate:
showClassesConfiguration();
} | [
"void",
"configureClasses",
"(",
"String",
"path",
")",
"{",
"findClassesInClasspath",
"(",
")",
";",
"if",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"path",
")",
")",
"{",
"// If the path is set, set up class reloading:",
"configureClassesReloadable",
"(",
"path",
... | Sets up configuration for reloading classes.
@param path The directory that contains compiled classes. This will be
monitored for changes. | [
"Sets",
"up",
"configuration",
"for",
"reloading",
"classes",
"."
] | 3f84ece1bd016fbb597c624d46fcca5a2580a33d | https://github.com/davidcarboni/restolino/blob/3f84ece1bd016fbb597c624d46fcca5a2580a33d/src/main/java/com/github/davidcarboni/restolino/Configuration.java#L207-L220 | train |
davidcarboni/restolino | src/main/java/com/github/davidcarboni/restolino/Configuration.java | Configuration.configureAuthentication | private void configureAuthentication(String username, String password, String realm) {
// If the username is set, set up authentication:
if (StringUtils.isNotBlank(username)) {
this.username = username;
this.password = password;
this.realm = StringUtils.defaultIfBlank(realm, "restolino");
authenticationEnabled = true;
}
} | java | private void configureAuthentication(String username, String password, String realm) {
// If the username is set, set up authentication:
if (StringUtils.isNotBlank(username)) {
this.username = username;
this.password = password;
this.realm = StringUtils.defaultIfBlank(realm, "restolino");
authenticationEnabled = true;
}
} | [
"private",
"void",
"configureAuthentication",
"(",
"String",
"username",
",",
"String",
"password",
",",
"String",
"realm",
")",
"{",
"// If the username is set, set up authentication:",
"if",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"username",
")",
")",
"{",
"t... | Sets up authentication.
@param username The HTTP basic authentication username.
@param password The HTTP basic authentication password.
@param realm Optional. Defaults to "restolino". | [
"Sets",
"up",
"authentication",
"."
] | 3f84ece1bd016fbb597c624d46fcca5a2580a33d | https://github.com/davidcarboni/restolino/blob/3f84ece1bd016fbb597c624d46fcca5a2580a33d/src/main/java/com/github/davidcarboni/restolino/Configuration.java#L229-L240 | train |
davidcarboni/restolino | src/main/java/com/github/davidcarboni/restolino/Configuration.java | Configuration.showFilesConfiguration | void showFilesConfiguration() {
// Message to communicate the resolved configuration:
String message;
if (filesUrl != null) {
String reload = filesReloadable ? "reloadable" : "non-reloadable";
message = "Files will be served from: " + filesUrl + " (" + reload + ")";
} else {
message = "No static files will be served.";
}
log.info("Files: {}", message);
} | java | void showFilesConfiguration() {
// Message to communicate the resolved configuration:
String message;
if (filesUrl != null) {
String reload = filesReloadable ? "reloadable" : "non-reloadable";
message = "Files will be served from: " + filesUrl + " (" + reload + ")";
} else {
message = "No static files will be served.";
}
log.info("Files: {}", message);
} | [
"void",
"showFilesConfiguration",
"(",
")",
"{",
"// Message to communicate the resolved configuration:",
"String",
"message",
";",
"if",
"(",
"filesUrl",
"!=",
"null",
")",
"{",
"String",
"reload",
"=",
"filesReloadable",
"?",
"\"reloadable\"",
":",
"\"non-reloadable\"... | Prints out a message confirming the static file serving configuration. | [
"Prints",
"out",
"a",
"message",
"confirming",
"the",
"static",
"file",
"serving",
"configuration",
"."
] | 3f84ece1bd016fbb597c624d46fcca5a2580a33d | https://github.com/davidcarboni/restolino/blob/3f84ece1bd016fbb597c624d46fcca5a2580a33d/src/main/java/com/github/davidcarboni/restolino/Configuration.java#L356-L367 | train |
davidcarboni/restolino | src/main/java/com/github/davidcarboni/restolino/Configuration.java | Configuration.showClassesConfiguration | void showClassesConfiguration() {
// Warning about a classes folder present in the classpath:
if (classesInClasspath != null) {
log.warn("Dynamic class reloading is disabled because a classes URL is present in the classpath. P"
+ "lease launch without including your classes directory: {}", classesInClasspath);
}
// Message to communicate the resolved configuration:
String message;
if (classesReloadable) {
if (StringUtils.isNotBlank(packagePrefix)) {
message = "Classes will be reloaded from: " + classesUrl;
} else {
message = "Classes will be reloaded from package " + packagePrefix + " at: " + classesUrl;
}
} else {
message = "Classes will not be dynamically reloaded.";
}
log.info("Classes: {}", message);
} | java | void showClassesConfiguration() {
// Warning about a classes folder present in the classpath:
if (classesInClasspath != null) {
log.warn("Dynamic class reloading is disabled because a classes URL is present in the classpath. P"
+ "lease launch without including your classes directory: {}", classesInClasspath);
}
// Message to communicate the resolved configuration:
String message;
if (classesReloadable) {
if (StringUtils.isNotBlank(packagePrefix)) {
message = "Classes will be reloaded from: " + classesUrl;
} else {
message = "Classes will be reloaded from package " + packagePrefix + " at: " + classesUrl;
}
} else {
message = "Classes will not be dynamically reloaded.";
}
log.info("Classes: {}", message);
} | [
"void",
"showClassesConfiguration",
"(",
")",
"{",
"// Warning about a classes folder present in the classpath:",
"if",
"(",
"classesInClasspath",
"!=",
"null",
")",
"{",
"log",
".",
"warn",
"(",
"\"Dynamic class reloading is disabled because a classes URL is present in the classpa... | Prints out a message confirming the class reloading configuration. | [
"Prints",
"out",
"a",
"message",
"confirming",
"the",
"class",
"reloading",
"configuration",
"."
] | 3f84ece1bd016fbb597c624d46fcca5a2580a33d | https://github.com/davidcarboni/restolino/blob/3f84ece1bd016fbb597c624d46fcca5a2580a33d/src/main/java/com/github/davidcarboni/restolino/Configuration.java#L372-L392 | train |
davidcarboni/restolino | src/main/java/com/github/davidcarboni/restolino/Configuration.java | Configuration.getValue | static String getValue(String key) {
String result = StringUtils.defaultIfBlank(System.getProperty(key), StringUtils.EMPTY);
result = StringUtils.defaultIfBlank(result, System.getenv(key));
return result;
} | java | static String getValue(String key) {
String result = StringUtils.defaultIfBlank(System.getProperty(key), StringUtils.EMPTY);
result = StringUtils.defaultIfBlank(result, System.getenv(key));
return result;
} | [
"static",
"String",
"getValue",
"(",
"String",
"key",
")",
"{",
"String",
"result",
"=",
"StringUtils",
".",
"defaultIfBlank",
"(",
"System",
".",
"getProperty",
"(",
"key",
")",
",",
"StringUtils",
".",
"EMPTY",
")",
";",
"result",
"=",
"StringUtils",
"."... | Gets a configured value for the given key from either the system
properties or an environment variable.
@param key The name of the configuration value.
@return The system property corresponding to the given key (e.g.
-Dkey=value). If that is blank, the environment variable
corresponding to the given key (e.g. EXPORT key=value). If that
is blank, {@link StringUtils#EMPTY}. | [
"Gets",
"a",
"configured",
"value",
"for",
"the",
"given",
"key",
"from",
"either",
"the",
"system",
"properties",
"or",
"an",
"environment",
"variable",
"."
] | 3f84ece1bd016fbb597c624d46fcca5a2580a33d | https://github.com/davidcarboni/restolino/blob/3f84ece1bd016fbb597c624d46fcca5a2580a33d/src/main/java/com/github/davidcarboni/restolino/Configuration.java#L404-L408 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/pruefung/LengthValidator.java | LengthValidator.isValid | @Override
public boolean isValid(T wert) {
int length = Objects.toString(wert, "").length();
return (length >= min) && (length <= max);
} | java | @Override
public boolean isValid(T wert) {
int length = Objects.toString(wert, "").length();
return (length >= min) && (length <= max);
} | [
"@",
"Override",
"public",
"boolean",
"isValid",
"(",
"T",
"wert",
")",
"{",
"int",
"length",
"=",
"Objects",
".",
"toString",
"(",
"wert",
",",
"\"\"",
")",
".",
"length",
"(",
")",
";",
"return",
"(",
"length",
">=",
"min",
")",
"&&",
"(",
"lengt... | Liefert true zurueck, wenn der uebergebene Wert innerhalb der erlaubten
Laenge liegt.
@param wert Fachwert oder gekapselter Wert
@return true oder false | [
"Liefert",
"true",
"zurueck",
"wenn",
"der",
"uebergebene",
"Wert",
"innerhalb",
"der",
"erlaubten",
"Laenge",
"liegt",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/pruefung/LengthValidator.java#L63-L67 | train |
hdbeukel/james-extensions | src/main/java/org/jamesframework/ext/analysis/Analysis.java | Analysis.setNumRuns | public Analysis<SolutionType> setNumRuns(String searchID, int n){
if(!searches.containsKey(searchID)){
throw new UnknownIDException("No search with ID " + searchID + " has been added.");
}
if(n <= 0){
throw new IllegalArgumentException("Number of runs should be strictly positive.");
}
searchNumRuns.put(searchID, n);
return this;
} | java | public Analysis<SolutionType> setNumRuns(String searchID, int n){
if(!searches.containsKey(searchID)){
throw new UnknownIDException("No search with ID " + searchID + " has been added.");
}
if(n <= 0){
throw new IllegalArgumentException("Number of runs should be strictly positive.");
}
searchNumRuns.put(searchID, n);
return this;
} | [
"public",
"Analysis",
"<",
"SolutionType",
">",
"setNumRuns",
"(",
"String",
"searchID",
",",
"int",
"n",
")",
"{",
"if",
"(",
"!",
"searches",
".",
"containsKey",
"(",
"searchID",
")",
")",
"{",
"throw",
"new",
"UnknownIDException",
"(",
"\"No search with I... | Set the number of runs to be performed for the given search. This does not affect the number
of runs of the other searches. Returns a reference to the analysis object on which this method
was called so that methods can be chained.
@param searchID ID of the search
@param n number of runs to be performed for this specific search
@return reference to the analysis object on which this method was called
@throws UnknownIDException if no search with this ID has been added
@throws IllegalArgumentException if <code>n</code> is not strictly positive | [
"Set",
"the",
"number",
"of",
"runs",
"to",
"be",
"performed",
"for",
"the",
"given",
"search",
".",
"This",
"does",
"not",
"affect",
"the",
"number",
"of",
"runs",
"of",
"the",
"other",
"searches",
".",
"Returns",
"a",
"reference",
"to",
"the",
"analysi... | 37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2 | https://github.com/hdbeukel/james-extensions/blob/37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2/src/main/java/org/jamesframework/ext/analysis/Analysis.java#L185-L194 | train |
hdbeukel/james-extensions | src/main/java/org/jamesframework/ext/analysis/Analysis.java | Analysis.setNumBurnIn | public Analysis<SolutionType> setNumBurnIn(String searchID, int n){
if(!searches.containsKey(searchID)){
throw new UnknownIDException("No search with ID " + searchID + " has been added.");
}
if(n <= 0){
throw new IllegalArgumentException("Number of burn-in runs should be strictly positive.");
}
searchNumBurnIn.put(searchID, n);
return this;
} | java | public Analysis<SolutionType> setNumBurnIn(String searchID, int n){
if(!searches.containsKey(searchID)){
throw new UnknownIDException("No search with ID " + searchID + " has been added.");
}
if(n <= 0){
throw new IllegalArgumentException("Number of burn-in runs should be strictly positive.");
}
searchNumBurnIn.put(searchID, n);
return this;
} | [
"public",
"Analysis",
"<",
"SolutionType",
">",
"setNumBurnIn",
"(",
"String",
"searchID",
",",
"int",
"n",
")",
"{",
"if",
"(",
"!",
"searches",
".",
"containsKey",
"(",
"searchID",
")",
")",
"{",
"throw",
"new",
"UnknownIDException",
"(",
"\"No search with... | Set the number of additional burn-in runs to be performed for the given search. This does not affect
the number of burn-in runs of the other searches. Returns a reference to the analysis object on which
this method was called so that methods can be chained.
@param searchID ID of the search
@param n number of additional burn-in runs to be performed for this specific search
@return reference to the analysis object on which this method was called
@throws UnknownIDException if no search with this ID has been added
@throws IllegalArgumentException if <code>n</code> is not strictly positive | [
"Set",
"the",
"number",
"of",
"additional",
"burn",
"-",
"in",
"runs",
"to",
"be",
"performed",
"for",
"the",
"given",
"search",
".",
"This",
"does",
"not",
"affect",
"the",
"number",
"of",
"burn",
"-",
"in",
"runs",
"of",
"the",
"other",
"searches",
"... | 37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2 | https://github.com/hdbeukel/james-extensions/blob/37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2/src/main/java/org/jamesframework/ext/analysis/Analysis.java#L225-L234 | train |
hdbeukel/james-extensions | src/main/java/org/jamesframework/ext/analysis/Analysis.java | Analysis.addProblem | public Analysis<SolutionType> addProblem(String ID, Problem<SolutionType> problem){
if(problem == null){
throw new NullPointerException("Problem can not be null.");
}
if(problems.containsKey(ID)){
throw new DuplicateIDException("Duplicate problem ID: " + ID + ".");
}
problems.put(ID, problem);
return this;
} | java | public Analysis<SolutionType> addProblem(String ID, Problem<SolutionType> problem){
if(problem == null){
throw new NullPointerException("Problem can not be null.");
}
if(problems.containsKey(ID)){
throw new DuplicateIDException("Duplicate problem ID: " + ID + ".");
}
problems.put(ID, problem);
return this;
} | [
"public",
"Analysis",
"<",
"SolutionType",
">",
"addProblem",
"(",
"String",
"ID",
",",
"Problem",
"<",
"SolutionType",
">",
"problem",
")",
"{",
"if",
"(",
"problem",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Problem can not be n... | Add a problem to be analyzed. Returns a reference to the analysis object on which this
method was called so that methods can be chained.
@param ID unique ID of the added problem
@param problem problem to be added to the analysis
@return reference to the analysis object on which this method was called
@throws DuplicateIDException if a problem has already been added with the specified ID
@throws NullPointerException if <code>problem</code> is <code>null</code> | [
"Add",
"a",
"problem",
"to",
"be",
"analyzed",
".",
"Returns",
"a",
"reference",
"to",
"the",
"analysis",
"object",
"on",
"which",
"this",
"method",
"was",
"called",
"so",
"that",
"methods",
"can",
"be",
"chained",
"."
] | 37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2 | https://github.com/hdbeukel/james-extensions/blob/37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2/src/main/java/org/jamesframework/ext/analysis/Analysis.java#L246-L255 | train |
hdbeukel/james-extensions | src/main/java/org/jamesframework/ext/analysis/Analysis.java | Analysis.addSearch | public Analysis<SolutionType> addSearch(String ID, SearchFactory<SolutionType> searchFactory){
if(searchFactory == null){
throw new NullPointerException("Search factory can not be null.");
}
if(searches.containsKey(ID)){
throw new DuplicateIDException("Duplicate search ID: " + ID + ".");
}
searches.put(ID, searchFactory);
return this;
} | java | public Analysis<SolutionType> addSearch(String ID, SearchFactory<SolutionType> searchFactory){
if(searchFactory == null){
throw new NullPointerException("Search factory can not be null.");
}
if(searches.containsKey(ID)){
throw new DuplicateIDException("Duplicate search ID: " + ID + ".");
}
searches.put(ID, searchFactory);
return this;
} | [
"public",
"Analysis",
"<",
"SolutionType",
">",
"addSearch",
"(",
"String",
"ID",
",",
"SearchFactory",
"<",
"SolutionType",
">",
"searchFactory",
")",
"{",
"if",
"(",
"searchFactory",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Sea... | Add a search to be applied to solve the analyzed problems. Requires a search factory instead of a
plain search as a new instance of the search will be created for every run and for every analyzed
problem. Returns a reference to the analysis object on which this method was called so that methods
can be chained.
@param ID unique ID of the added search
@param searchFactory factory that creates a search given the problem to be solved
@return reference to the analysis object on which this method was called
@throws DuplicateIDException if a search has already been added with the specified ID
@throws NullPointerException if <code>searchFactory</code> is <code>null</code> | [
"Add",
"a",
"search",
"to",
"be",
"applied",
"to",
"solve",
"the",
"analyzed",
"problems",
".",
"Requires",
"a",
"search",
"factory",
"instead",
"of",
"a",
"plain",
"search",
"as",
"a",
"new",
"instance",
"of",
"the",
"search",
"will",
"be",
"created",
"... | 37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2 | https://github.com/hdbeukel/james-extensions/blob/37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2/src/main/java/org/jamesframework/ext/analysis/Analysis.java#L269-L278 | train |
hdbeukel/james-extensions | src/main/java/org/jamesframework/ext/analysis/Analysis.java | Analysis.run | public AnalysisResults<SolutionType> run(){
// create results object
AnalysisResults<SolutionType> results = new AnalysisResults<>();
// log
LOGGER.info(ANALYSIS_MARKER,
"Started analysis of {} problems {} using {} searches {}.",
problems.size(),
problems.keySet(),
searches.size(),
searches.keySet());
// analyze each problem
problems.forEach((problemID, problem) -> {
LOGGER.info(ANALYSIS_MARKER, "Analyzing problem {}.", problemID);
// apply all searches
searches.forEach((searchID, searchFactory) -> {
// execute burn-in runs
int nBurnIn = getNumBurnIn(searchID);
for(int burnIn=0; burnIn<nBurnIn; burnIn++){
LOGGER.info(ANALYSIS_MARKER,
"Burn-in of search {} applied to problem {} (burn-in run {}/{}).",
searchID, problemID, burnIn+1, nBurnIn);
// create search
Search<SolutionType> search = searchFactory.create(problem);
// run search
search.start();
// dispose search
search.dispose();
LOGGER.info(ANALYSIS_MARKER,
"Finished burn-in run {}/{} of search {} for problem {}.",
burnIn+1, nBurnIn, searchID, problemID);
}
// perform actual search runs and register results
int nRuns = getNumRuns(searchID);
for(int run=0; run<nRuns; run++){
LOGGER.info(ANALYSIS_MARKER,
"Applying search {} to problem {} (run {}/{}).",
searchID, problemID, run+1, nRuns);
// create search
Search<SolutionType> search = searchFactory.create(problem);
// attach listener
AnalysisListener listener = new AnalysisListener();
search.addSearchListener(listener);
// run search
search.start();
// dispose search
search.dispose();
// register search run in results object
results.registerSearchRun(problemID, searchID, listener.getSearchRunResults());
LOGGER.info(ANALYSIS_MARKER,
"Finished run {}/{} of search {} for problem {}.",
run+1, nRuns, searchID, problemID);
}
});
LOGGER.info(ANALYSIS_MARKER, "Done analyzing problem {}.", problemID);
});
// log
LOGGER.info(ANALYSIS_MARKER, "Analysis complete.");
return results;
} | java | public AnalysisResults<SolutionType> run(){
// create results object
AnalysisResults<SolutionType> results = new AnalysisResults<>();
// log
LOGGER.info(ANALYSIS_MARKER,
"Started analysis of {} problems {} using {} searches {}.",
problems.size(),
problems.keySet(),
searches.size(),
searches.keySet());
// analyze each problem
problems.forEach((problemID, problem) -> {
LOGGER.info(ANALYSIS_MARKER, "Analyzing problem {}.", problemID);
// apply all searches
searches.forEach((searchID, searchFactory) -> {
// execute burn-in runs
int nBurnIn = getNumBurnIn(searchID);
for(int burnIn=0; burnIn<nBurnIn; burnIn++){
LOGGER.info(ANALYSIS_MARKER,
"Burn-in of search {} applied to problem {} (burn-in run {}/{}).",
searchID, problemID, burnIn+1, nBurnIn);
// create search
Search<SolutionType> search = searchFactory.create(problem);
// run search
search.start();
// dispose search
search.dispose();
LOGGER.info(ANALYSIS_MARKER,
"Finished burn-in run {}/{} of search {} for problem {}.",
burnIn+1, nBurnIn, searchID, problemID);
}
// perform actual search runs and register results
int nRuns = getNumRuns(searchID);
for(int run=0; run<nRuns; run++){
LOGGER.info(ANALYSIS_MARKER,
"Applying search {} to problem {} (run {}/{}).",
searchID, problemID, run+1, nRuns);
// create search
Search<SolutionType> search = searchFactory.create(problem);
// attach listener
AnalysisListener listener = new AnalysisListener();
search.addSearchListener(listener);
// run search
search.start();
// dispose search
search.dispose();
// register search run in results object
results.registerSearchRun(problemID, searchID, listener.getSearchRunResults());
LOGGER.info(ANALYSIS_MARKER,
"Finished run {}/{} of search {} for problem {}.",
run+1, nRuns, searchID, problemID);
}
});
LOGGER.info(ANALYSIS_MARKER, "Done analyzing problem {}.", problemID);
});
// log
LOGGER.info(ANALYSIS_MARKER, "Analysis complete.");
return results;
} | [
"public",
"AnalysisResults",
"<",
"SolutionType",
">",
"run",
"(",
")",
"{",
"// create results object",
"AnalysisResults",
"<",
"SolutionType",
">",
"results",
"=",
"new",
"AnalysisResults",
"<>",
"(",
")",
";",
"// log",
"LOGGER",
".",
"info",
"(",
"ANALYSIS_M... | Run the analysis. The returned results can be accessed directly or written to a JSON file to be
loaded into R for analysis and visualization using the james-analysis R package. The analysis
progress is logged at INFO level, all log messages being tagged with a marker "analysis".
@return results of the analysis
@throws JamesRuntimeException if anything goes wrong during any of the searches due to misconfiguration | [
"Run",
"the",
"analysis",
".",
"The",
"returned",
"results",
"can",
"be",
"accessed",
"directly",
"or",
"written",
"to",
"a",
"JSON",
"file",
"to",
"be",
"loaded",
"into",
"R",
"for",
"analysis",
"and",
"visualization",
"using",
"the",
"james",
"-",
"analy... | 37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2 | https://github.com/hdbeukel/james-extensions/blob/37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2/src/main/java/org/jamesframework/ext/analysis/Analysis.java#L288-L352 | train |
DaGeRe/KoPeMe | kopeme-mojo/src/main/java/de/kopeme/caller/ExternalKoPeMeRunner.java | ExternalKoPeMeRunner.run | public int run() {
try {
if ( compile )
{
compile();
}
String separator = "/";
String cpseperator = ":";
if (System.getProperty("os.name").contains("indows")){
separator = "\\";
cpseperator = ";";
}
String s = fileName.replace(separator, ".");
if ( ".java".equals(s.substring(s.length()-5)))
{
s = s.substring(0, s.length()-5); // .java Entfernen
}
else
{
s = s.substring(0, s.length() - 6); // .class entfernen
}
String localClasspath = classpath;
if (compileFolder != null)
localClasspath = localClasspath + cpseperator + compileFolder;
String command = "java -cp "+localClasspath;
if (libraryPath != null && libraryPath!= "")
command += "-Djava.library.path="+libraryPath;
command = command + " de.kopeme.testrunner.PerformanceTestRunner " + s;
// System.out.println(command);
Process p = Runtime.getRuntime().exec(command);
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
BufferedWriter bw = null;
// System.out.println("ExternalOutputFile: " + externalOutputFile);
if ( externalOutputFile != null && externalOutputFile != "")
{
File output = new File(externalOutputFile);
try {
bw = new BufferedWriter( new FileWriter(output));
} catch (IOException e1) {
// TODO Automatisch generierter Erfassungsblock
e1.printStackTrace();
}
}
while ( (line = br.readLine()) != null )
{
if ( bw == null)
{
System.out.println(line);
}
else
{
bw.write(line+"\n");
}
}
br = new BufferedReader(new InputStreamReader(p.getErrorStream()));
while ( (line = br.readLine()) != null )
{
if ( bw == null)
{
System.out.println(line);
}
else
{
bw.write(line+"\n");
}
}
if ( bw != null )
bw.close();
int returnValue = p.waitFor();
// System.out.println("Returnvalue: " + returnValue);
return returnValue;
} catch (IOException e) {
// TODO Automatisch generierter Erfassungsblock
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Automatisch generierter Erfassungsblock
e.printStackTrace();
}
return 1;
} | java | public int run() {
try {
if ( compile )
{
compile();
}
String separator = "/";
String cpseperator = ":";
if (System.getProperty("os.name").contains("indows")){
separator = "\\";
cpseperator = ";";
}
String s = fileName.replace(separator, ".");
if ( ".java".equals(s.substring(s.length()-5)))
{
s = s.substring(0, s.length()-5); // .java Entfernen
}
else
{
s = s.substring(0, s.length() - 6); // .class entfernen
}
String localClasspath = classpath;
if (compileFolder != null)
localClasspath = localClasspath + cpseperator + compileFolder;
String command = "java -cp "+localClasspath;
if (libraryPath != null && libraryPath!= "")
command += "-Djava.library.path="+libraryPath;
command = command + " de.kopeme.testrunner.PerformanceTestRunner " + s;
// System.out.println(command);
Process p = Runtime.getRuntime().exec(command);
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
BufferedWriter bw = null;
// System.out.println("ExternalOutputFile: " + externalOutputFile);
if ( externalOutputFile != null && externalOutputFile != "")
{
File output = new File(externalOutputFile);
try {
bw = new BufferedWriter( new FileWriter(output));
} catch (IOException e1) {
// TODO Automatisch generierter Erfassungsblock
e1.printStackTrace();
}
}
while ( (line = br.readLine()) != null )
{
if ( bw == null)
{
System.out.println(line);
}
else
{
bw.write(line+"\n");
}
}
br = new BufferedReader(new InputStreamReader(p.getErrorStream()));
while ( (line = br.readLine()) != null )
{
if ( bw == null)
{
System.out.println(line);
}
else
{
bw.write(line+"\n");
}
}
if ( bw != null )
bw.close();
int returnValue = p.waitFor();
// System.out.println("Returnvalue: " + returnValue);
return returnValue;
} catch (IOException e) {
// TODO Automatisch generierter Erfassungsblock
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Automatisch generierter Erfassungsblock
e.printStackTrace();
}
return 1;
} | [
"public",
"int",
"run",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"compile",
")",
"{",
"compile",
"(",
")",
";",
"}",
"String",
"separator",
"=",
"\"/\"",
";",
"String",
"cpseperator",
"=",
"\":\"",
";",
"if",
"(",
"System",
".",
"getProperty",
"(",
"\... | Runs KoPeMe, and returns 0, if everything works allright
@return 0, if everything works allright | [
"Runs",
"KoPeMe",
"and",
"returns",
"0",
"if",
"everything",
"works",
"allright"
] | a4939113cba73cb20a2c7d6dc8d34d0139a3e340 | https://github.com/DaGeRe/KoPeMe/blob/a4939113cba73cb20a2c7d6dc8d34d0139a3e340/kopeme-mojo/src/main/java/de/kopeme/caller/ExternalKoPeMeRunner.java#L98-L188 | train |
kyoken74/gwt-angular | gwt-angular-resources/src/main/java/com/asayama/gwt/angular/resources/client/directive/GwtImageResource.java | GwtImageResource.link | @Override
public void link(NGScope scope, JQElement element, JSON attrs) {
ImageResource resource = scope.get(getName());
if (resource == null) {
LOG.log(Level.WARNING, "Mandatory attribute " + getName() + " value is mssing");
return;
}
Image image = new Image(resource);
Element target = image.asWidget().getElement();
String className = element.attr("class");
target.addClassName(className);
String style = element.attr("style");
target.setAttribute("style", style);
element.replaceWith(target);
} | java | @Override
public void link(NGScope scope, JQElement element, JSON attrs) {
ImageResource resource = scope.get(getName());
if (resource == null) {
LOG.log(Level.WARNING, "Mandatory attribute " + getName() + " value is mssing");
return;
}
Image image = new Image(resource);
Element target = image.asWidget().getElement();
String className = element.attr("class");
target.addClassName(className);
String style = element.attr("style");
target.setAttribute("style", style);
element.replaceWith(target);
} | [
"@",
"Override",
"public",
"void",
"link",
"(",
"NGScope",
"scope",
",",
"JQElement",
"element",
",",
"JSON",
"attrs",
")",
"{",
"ImageResource",
"resource",
"=",
"scope",
".",
"get",
"(",
"getName",
"(",
")",
")",
";",
"if",
"(",
"resource",
"==",
"nu... | Replaces the element body with the ImageResource passed via
gwt-image-resource attribute. | [
"Replaces",
"the",
"element",
"body",
"with",
"the",
"ImageResource",
"passed",
"via",
"gwt",
"-",
"image",
"-",
"resource",
"attribute",
"."
] | 99a6efa277dd4771d9cba976b25fdf0ac4fdeca2 | https://github.com/kyoken74/gwt-angular/blob/99a6efa277dd4771d9cba976b25fdf0ac4fdeca2/gwt-angular-resources/src/main/java/com/asayama/gwt/angular/resources/client/directive/GwtImageResource.java#L49-L63 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/bank/Bankverbindung.java | Bankverbindung.toMap | @Override
public Map<String, Object> toMap() {
Map<String, Object> map = new HashMap<>();
map.put("kontoinhaber", getKontoinhaber());
map.put("iban", getIban());
getBic().ifPresent(b -> map.put("bic", b));
return map;
} | java | @Override
public Map<String, Object> toMap() {
Map<String, Object> map = new HashMap<>();
map.put("kontoinhaber", getKontoinhaber());
map.put("iban", getIban());
getBic().ifPresent(b -> map.put("bic", b));
return map;
} | [
"@",
"Override",
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"toMap",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"map",
".",
"put",
"(",
"\"kontoinhaber\"",
",",
"getKontoinhabe... | Liefert die einzelnen Attribute einer Bankverbindung als Map.
@return Attribute als Map | [
"Liefert",
"die",
"einzelnen",
"Attribute",
"einer",
"Bankverbindung",
"als",
"Map",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/bank/Bankverbindung.java#L193-L200 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Strings.java | Strings.repeat | public static String repeat(char source, int times) {
dbc.precondition(times > -1, "times must be non negative");
final char[] array = new char[times];
Arrays.fill(array, source);
return new String(array);
} | java | public static String repeat(char source, int times) {
dbc.precondition(times > -1, "times must be non negative");
final char[] array = new char[times];
Arrays.fill(array, source);
return new String(array);
} | [
"public",
"static",
"String",
"repeat",
"(",
"char",
"source",
",",
"int",
"times",
")",
"{",
"dbc",
".",
"precondition",
"(",
"times",
">",
"-",
"1",
",",
"\"times must be non negative\"",
")",
";",
"final",
"char",
"[",
"]",
"array",
"=",
"new",
"char"... | Creates a String by repeating the source char.
@param source the source char
@param times times the source char will be repeated
@return the resulting string | [
"Creates",
"a",
"String",
"by",
"repeating",
"the",
"source",
"char",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Strings.java#L177-L182 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Strings.java | Strings.repeat | public static String repeat(String source, int times) {
dbc.precondition(source != null, "cannot repeat a null source");
dbc.precondition(times > -1, "times must be non negative");
final int srcLen = source.length();
final long longLen = times * (long) srcLen;
final int len = (int) longLen;
dbc.precondition(longLen == len, "resulting String would be too long");
final char[] array = new char[len];
for (int i = 0; i != times; ++i) {
source.getChars(0, srcLen, array, i * srcLen);
}
return new String(array);
} | java | public static String repeat(String source, int times) {
dbc.precondition(source != null, "cannot repeat a null source");
dbc.precondition(times > -1, "times must be non negative");
final int srcLen = source.length();
final long longLen = times * (long) srcLen;
final int len = (int) longLen;
dbc.precondition(longLen == len, "resulting String would be too long");
final char[] array = new char[len];
for (int i = 0; i != times; ++i) {
source.getChars(0, srcLen, array, i * srcLen);
}
return new String(array);
} | [
"public",
"static",
"String",
"repeat",
"(",
"String",
"source",
",",
"int",
"times",
")",
"{",
"dbc",
".",
"precondition",
"(",
"source",
"!=",
"null",
",",
"\"cannot repeat a null source\"",
")",
";",
"dbc",
".",
"precondition",
"(",
"times",
">",
"-",
"... | Creates a String by repeating the source string.
@param source the source String
@param times times the source String will be repeated
@return the resulting string | [
"Creates",
"a",
"String",
"by",
"repeating",
"the",
"source",
"string",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Strings.java#L191-L203 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/math/Nummer.java | Nummer.of | public static Nummer of(long code) {
if ((code >= 0) && (code < CACHE.length)) {
return CACHE[(int) code];
} else {
return new Nummer(code);
}
} | java | public static Nummer of(long code) {
if ((code >= 0) && (code < CACHE.length)) {
return CACHE[(int) code];
} else {
return new Nummer(code);
}
} | [
"public",
"static",
"Nummer",
"of",
"(",
"long",
"code",
")",
"{",
"if",
"(",
"(",
"code",
">=",
"0",
")",
"&&",
"(",
"code",
"<",
"CACHE",
".",
"length",
")",
")",
"{",
"return",
"CACHE",
"[",
"(",
"int",
")",
"code",
"]",
";",
"}",
"else",
... | Die of-Methode liefert fuer kleine Nummer immer dasselbe Objekt zurueck.
Vor allem wenn man nur kleinere Nummern hat, lohnt sich der Aufruf
dieser Methode.
@param code Nummer
@return eine (evtl. bereits instanziierte) Nummer | [
"Die",
"of",
"-",
"Methode",
"liefert",
"fuer",
"kleine",
"Nummer",
"immer",
"dasselbe",
"Objekt",
"zurueck",
".",
"Vor",
"allem",
"wenn",
"man",
"nur",
"kleinere",
"Nummern",
"hat",
"lohnt",
"sich",
"der",
"Aufruf",
"dieser",
"Methode",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/math/Nummer.java#L93-L99 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/math/Nummer.java | Nummer.validate | public static String validate(String nummer) {
try {
return new BigInteger(nummer).toString();
} catch (NumberFormatException nfe) {
throw new InvalidValueException(nummer, "number");
}
} | java | public static String validate(String nummer) {
try {
return new BigInteger(nummer).toString();
} catch (NumberFormatException nfe) {
throw new InvalidValueException(nummer, "number");
}
} | [
"public",
"static",
"String",
"validate",
"(",
"String",
"nummer",
")",
"{",
"try",
"{",
"return",
"new",
"BigInteger",
"(",
"nummer",
")",
".",
"toString",
"(",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"nfe",
")",
"{",
"throw",
"new",
"Inva... | Ueberprueft, ob der uebergebene String auch tatsaechlich eine Zahl ist.
@param nummer z.B. "4711"
@return validierter String zur Weiterverarbeitung | [
"Ueberprueft",
"ob",
"der",
"uebergebene",
"String",
"auch",
"tatsaechlich",
"eine",
"Zahl",
"ist",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/math/Nummer.java#L148-L154 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/options/OptionalIterator.java | OptionalIterator.next | @Override
public Optional<E> next() {
if (iterator.hasNext()) {
return Optional.of(iterator.next());
}
return Optional.empty();
} | java | @Override
public Optional<E> next() {
if (iterator.hasNext()) {
return Optional.of(iterator.next());
}
return Optional.empty();
} | [
"@",
"Override",
"public",
"Optional",
"<",
"E",
">",
"next",
"(",
")",
"{",
"if",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"return",
"Optional",
".",
"of",
"(",
"iterator",
".",
"next",
"(",
")",
")",
";",
"}",
"return",
"Optional",
... | calling next over the boundary of the contained iterator leads
Optional.empty indefinitely "no matter how many times you try, you can't
shoot the dog"
@return Optional yielding next element if present, Optional.empty() otherwise | [
"calling",
"next",
"over",
"the",
"boundary",
"of",
"the",
"contained",
"iterator",
"leads",
"Optional",
".",
"empty",
"indefinitely",
"no",
"matter",
"how",
"many",
"times",
"you",
"try",
"you",
"can",
"t",
"shoot",
"the",
"dog"
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/options/OptionalIterator.java#L36-L42 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/rechnung/Rechnungsmonat.java | Rechnungsmonat.ersterArbeitstag | public LocalDate ersterArbeitstag() {
LocalDate tag = ersterTag();
switch (tag.getDayOfWeek()) {
case SATURDAY:
return tag.plusDays(2);
case SUNDAY:
return tag.plusDays(1);
default:
return tag;
}
} | java | public LocalDate ersterArbeitstag() {
LocalDate tag = ersterTag();
switch (tag.getDayOfWeek()) {
case SATURDAY:
return tag.plusDays(2);
case SUNDAY:
return tag.plusDays(1);
default:
return tag;
}
} | [
"public",
"LocalDate",
"ersterArbeitstag",
"(",
")",
"{",
"LocalDate",
"tag",
"=",
"ersterTag",
"(",
")",
";",
"switch",
"(",
"tag",
".",
"getDayOfWeek",
"(",
")",
")",
"{",
"case",
"SATURDAY",
":",
"return",
"tag",
".",
"plusDays",
"(",
"2",
")",
";",... | Diese Methode liefert den ersten Arbeitstag eines Monats. Allerdings
werden dabei keine Feiertag beruecksichtigt, sondern nur die Wochenende,
die auf einen ersten des Monats fallen, werden berucksichtigt.
@return erster Arbeitstag
@since 0.6 | [
"Diese",
"Methode",
"liefert",
"den",
"ersten",
"Arbeitstag",
"eines",
"Monats",
".",
"Allerdings",
"werden",
"dabei",
"keine",
"Feiertag",
"beruecksichtigt",
"sondern",
"nur",
"die",
"Wochenende",
"die",
"auf",
"einen",
"ersten",
"des",
"Monats",
"fallen",
"werde... | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/rechnung/Rechnungsmonat.java#L375-L385 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/rechnung/Rechnungsmonat.java | Rechnungsmonat.letzterArbeitstag | public LocalDate letzterArbeitstag() {
LocalDate tag = letzterTag();
switch (tag.getDayOfWeek()) {
case SATURDAY:
return tag.minusDays(1);
case SUNDAY:
return tag.minusDays(2);
default:
return tag;
}
} | java | public LocalDate letzterArbeitstag() {
LocalDate tag = letzterTag();
switch (tag.getDayOfWeek()) {
case SATURDAY:
return tag.minusDays(1);
case SUNDAY:
return tag.minusDays(2);
default:
return tag;
}
} | [
"public",
"LocalDate",
"letzterArbeitstag",
"(",
")",
"{",
"LocalDate",
"tag",
"=",
"letzterTag",
"(",
")",
";",
"switch",
"(",
"tag",
".",
"getDayOfWeek",
"(",
")",
")",
"{",
"case",
"SATURDAY",
":",
"return",
"tag",
".",
"minusDays",
"(",
"1",
")",
"... | Diese Methode liefert den letzten Arbeitstag eines Monats. Allerdings
werden dabei keine Feiertag beruecksichtigt, sondern nur die Wochenende,
die auf einen letzten des Monats fallen, werden berucksichtigt.
@return letzter Arbeitstag
@since 0.6 | [
"Diese",
"Methode",
"liefert",
"den",
"letzten",
"Arbeitstag",
"eines",
"Monats",
".",
"Allerdings",
"werden",
"dabei",
"keine",
"Feiertag",
"beruecksichtigt",
"sondern",
"nur",
"die",
"Wochenende",
"die",
"auf",
"einen",
"letzten",
"des",
"Monats",
"fallen",
"wer... | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/rechnung/Rechnungsmonat.java#L422-L432 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Pipelines.java | Pipelines.pipeline | public static <T> Consumer<T> pipeline(Consumer<T> consumer) {
return new PipelinedConsumer<T>(Iterations.iterable(consumer));
} | java | public static <T> Consumer<T> pipeline(Consumer<T> consumer) {
return new PipelinedConsumer<T>(Iterations.iterable(consumer));
} | [
"public",
"static",
"<",
"T",
">",
"Consumer",
"<",
"T",
">",
"pipeline",
"(",
"Consumer",
"<",
"T",
">",
"consumer",
")",
"{",
"return",
"new",
"PipelinedConsumer",
"<",
"T",
">",
"(",
"Iterations",
".",
"iterable",
"(",
"consumer",
")",
")",
";",
"... | Creates a pipeline from an consumer.
@param <T> the consumer parameter type
@param consumer the consumer to be transformed
@return the pipelined consumer | [
"Creates",
"a",
"pipeline",
"from",
"an",
"consumer",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Pipelines.java#L115-L117 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Pipelines.java | Pipelines.pipeline | public static <T> Consumer<T> pipeline(Consumer<T> former, Consumer<T> latter) {
return new PipelinedConsumer<T>(Iterations.iterable(former, latter));
} | java | public static <T> Consumer<T> pipeline(Consumer<T> former, Consumer<T> latter) {
return new PipelinedConsumer<T>(Iterations.iterable(former, latter));
} | [
"public",
"static",
"<",
"T",
">",
"Consumer",
"<",
"T",
">",
"pipeline",
"(",
"Consumer",
"<",
"T",
">",
"former",
",",
"Consumer",
"<",
"T",
">",
"latter",
")",
"{",
"return",
"new",
"PipelinedConsumer",
"<",
"T",
">",
"(",
"Iterations",
".",
"iter... | Creates a pipeline from two actions.
@param <T> the consumer parameter type
@param former the former consumer
@param latter the latter consumer
@return the pipelined consumer | [
"Creates",
"a",
"pipeline",
"from",
"two",
"actions",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Pipelines.java#L127-L129 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Pipelines.java | Pipelines.pipeline | public static <T> Consumer<T> pipeline(Consumer<T> first, Consumer<T> second, Consumer<T> third) {
return new PipelinedConsumer<T>(Iterations.iterable(first, second, third));
} | java | public static <T> Consumer<T> pipeline(Consumer<T> first, Consumer<T> second, Consumer<T> third) {
return new PipelinedConsumer<T>(Iterations.iterable(first, second, third));
} | [
"public",
"static",
"<",
"T",
">",
"Consumer",
"<",
"T",
">",
"pipeline",
"(",
"Consumer",
"<",
"T",
">",
"first",
",",
"Consumer",
"<",
"T",
">",
"second",
",",
"Consumer",
"<",
"T",
">",
"third",
")",
"{",
"return",
"new",
"PipelinedConsumer",
"<",... | Creates a pipeline from three actions.
@param <T> the consumer parameter type
@param first the first consumer
@param second the second consumer
@param third the third consumer
@return the pipelined consumer | [
"Creates",
"a",
"pipeline",
"from",
"three",
"actions",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Pipelines.java#L140-L142 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Pipelines.java | Pipelines.pipeline | public static <T> Consumer<T> pipeline(Consumer<T>... actions) {
return new PipelinedConsumer<T>(Iterations.iterable(actions));
} | java | public static <T> Consumer<T> pipeline(Consumer<T>... actions) {
return new PipelinedConsumer<T>(Iterations.iterable(actions));
} | [
"public",
"static",
"<",
"T",
">",
"Consumer",
"<",
"T",
">",
"pipeline",
"(",
"Consumer",
"<",
"T",
">",
"...",
"actions",
")",
"{",
"return",
"new",
"PipelinedConsumer",
"<",
"T",
">",
"(",
"Iterations",
".",
"iterable",
"(",
"actions",
")",
")",
"... | Creates a pipeline from an array of actions.
@param <T> the consumer parameter type
@param actions the array of actions to be transformed
@return the pipelined consumer | [
"Creates",
"a",
"pipeline",
"from",
"an",
"array",
"of",
"actions",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Pipelines.java#L151-L153 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Pipelines.java | Pipelines.pipeline | public static <T1, T2> BiConsumer<T1, T2> pipeline(BiConsumer<T1, T2> consumer) {
return new PipelinedBinaryConsumer<T1, T2>(Iterations.iterable(consumer));
} | java | public static <T1, T2> BiConsumer<T1, T2> pipeline(BiConsumer<T1, T2> consumer) {
return new PipelinedBinaryConsumer<T1, T2>(Iterations.iterable(consumer));
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
">",
"BiConsumer",
"<",
"T1",
",",
"T2",
">",
"pipeline",
"(",
"BiConsumer",
"<",
"T1",
",",
"T2",
">",
"consumer",
")",
"{",
"return",
"new",
"PipelinedBinaryConsumer",
"<",
"T1",
",",
"T2",
">",
"(",
"Itera... | Creates a pipeline from a binary consumer.
@param <T1> the consumer first parameter type
@param <T2> the consumer second parameter type
@param consumer the consumer to be transformed
@return the pipelined consumer | [
"Creates",
"a",
"pipeline",
"from",
"a",
"binary",
"consumer",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Pipelines.java#L163-L165 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Pipelines.java | Pipelines.pipeline | public static <T1, T2> BiConsumer<T1, T2> pipeline(BiConsumer<T1, T2> former, BiConsumer<T1, T2> latter) {
return new PipelinedBinaryConsumer<T1, T2>(Iterations.iterable(former, latter));
} | java | public static <T1, T2> BiConsumer<T1, T2> pipeline(BiConsumer<T1, T2> former, BiConsumer<T1, T2> latter) {
return new PipelinedBinaryConsumer<T1, T2>(Iterations.iterable(former, latter));
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
">",
"BiConsumer",
"<",
"T1",
",",
"T2",
">",
"pipeline",
"(",
"BiConsumer",
"<",
"T1",
",",
"T2",
">",
"former",
",",
"BiConsumer",
"<",
"T1",
",",
"T2",
">",
"latter",
")",
"{",
"return",
"new",
"Pipeline... | Creates a pipeline from two binary actions.
@param <T1> the consumer first parameter type
@param <T2> the consumer second parameter type
@param former the former consumer
@param latter the latter consumer
@return the pipelined consumer | [
"Creates",
"a",
"pipeline",
"from",
"two",
"binary",
"actions",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Pipelines.java#L176-L178 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Pipelines.java | Pipelines.pipeline | public static <T1, T2> BiConsumer<T1, T2> pipeline(BiConsumer<T1, T2> first, BiConsumer<T1, T2> second, BiConsumer<T1, T2> third) {
return new PipelinedBinaryConsumer<T1, T2>(Iterations.iterable(first, second, third));
} | java | public static <T1, T2> BiConsumer<T1, T2> pipeline(BiConsumer<T1, T2> first, BiConsumer<T1, T2> second, BiConsumer<T1, T2> third) {
return new PipelinedBinaryConsumer<T1, T2>(Iterations.iterable(first, second, third));
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
">",
"BiConsumer",
"<",
"T1",
",",
"T2",
">",
"pipeline",
"(",
"BiConsumer",
"<",
"T1",
",",
"T2",
">",
"first",
",",
"BiConsumer",
"<",
"T1",
",",
"T2",
">",
"second",
",",
"BiConsumer",
"<",
"T1",
",",
... | Creates a pipeline from three binary actions.
@param <T1> the consumer first parameter type
@param <T2> the consumer second parameter type
@param first the first consumer
@param second the second consumer
@param third the third consumer
@return the pipelined consumer | [
"Creates",
"a",
"pipeline",
"from",
"three",
"binary",
"actions",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Pipelines.java#L190-L192 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Pipelines.java | Pipelines.pipeline | public static <T1, T2> BiConsumer<T1, T2> pipeline(BiConsumer<T1, T2>... actions) {
return new PipelinedBinaryConsumer<T1, T2>(Iterations.iterable(actions));
} | java | public static <T1, T2> BiConsumer<T1, T2> pipeline(BiConsumer<T1, T2>... actions) {
return new PipelinedBinaryConsumer<T1, T2>(Iterations.iterable(actions));
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
">",
"BiConsumer",
"<",
"T1",
",",
"T2",
">",
"pipeline",
"(",
"BiConsumer",
"<",
"T1",
",",
"T2",
">",
"...",
"actions",
")",
"{",
"return",
"new",
"PipelinedBinaryConsumer",
"<",
"T1",
",",
"T2",
">",
"(",
... | Creates a pipeline from an array of binary actions.
@param <T1> the consumer first parameter type
@param <T2> the consumer second parameter type
@param actions the array of actions to be transformed
@return the pipelined consumer | [
"Creates",
"a",
"pipeline",
"from",
"an",
"array",
"of",
"binary",
"actions",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Pipelines.java#L202-L204 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Pipelines.java | Pipelines.pipeline | public static <T1, T2, T3> TriConsumer<T1, T2, T3> pipeline(TriConsumer<T1, T2, T3> consumer) {
return new PipelinedTernaryConsumer<T1, T2, T3>(Iterations.iterable(consumer));
} | java | public static <T1, T2, T3> TriConsumer<T1, T2, T3> pipeline(TriConsumer<T1, T2, T3> consumer) {
return new PipelinedTernaryConsumer<T1, T2, T3>(Iterations.iterable(consumer));
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
">",
"TriConsumer",
"<",
"T1",
",",
"T2",
",",
"T3",
">",
"pipeline",
"(",
"TriConsumer",
"<",
"T1",
",",
"T2",
",",
"T3",
">",
"consumer",
")",
"{",
"return",
"new",
"PipelinedTernaryConsumer",
"<... | Creates a pipeline from a ternary consumer.
@param <T1> the consumer first parameter type
@param <T2> the consumer second parameter type
@param <T3> the consumer third parameter type
@param consumer the consumer to be transformed
@return the pipelined consumer | [
"Creates",
"a",
"pipeline",
"from",
"a",
"ternary",
"consumer",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Pipelines.java#L215-L217 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Pipelines.java | Pipelines.pipeline | public static <T1, T2, T3> TriConsumer<T1, T2, T3> pipeline(TriConsumer<T1, T2, T3> former, TriConsumer<T1, T2, T3> latter) {
return new PipelinedTernaryConsumer<T1, T2, T3>(Iterations.iterable(former, latter));
} | java | public static <T1, T2, T3> TriConsumer<T1, T2, T3> pipeline(TriConsumer<T1, T2, T3> former, TriConsumer<T1, T2, T3> latter) {
return new PipelinedTernaryConsumer<T1, T2, T3>(Iterations.iterable(former, latter));
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
">",
"TriConsumer",
"<",
"T1",
",",
"T2",
",",
"T3",
">",
"pipeline",
"(",
"TriConsumer",
"<",
"T1",
",",
"T2",
",",
"T3",
">",
"former",
",",
"TriConsumer",
"<",
"T1",
",",
"T2",
",",
"T3",
... | Creates a pipeline from two ternary actions.
@param <T1> the consumer first parameter type
@param <T2> the consumer second parameter type
@param <T3> the consumer third parameter type
@param former the former consumer
@param latter the latter consumer
@return the pipelined consumer | [
"Creates",
"a",
"pipeline",
"from",
"two",
"ternary",
"actions",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Pipelines.java#L229-L231 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Pipelines.java | Pipelines.pipeline | public static <T1, T2, T3> TriConsumer<T1, T2, T3> pipeline(TriConsumer<T1, T2, T3> first, TriConsumer<T1, T2, T3> second, TriConsumer<T1, T2, T3> third) {
return new PipelinedTernaryConsumer<T1, T2, T3>(Iterations.iterable(first, second, third));
} | java | public static <T1, T2, T3> TriConsumer<T1, T2, T3> pipeline(TriConsumer<T1, T2, T3> first, TriConsumer<T1, T2, T3> second, TriConsumer<T1, T2, T3> third) {
return new PipelinedTernaryConsumer<T1, T2, T3>(Iterations.iterable(first, second, third));
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
">",
"TriConsumer",
"<",
"T1",
",",
"T2",
",",
"T3",
">",
"pipeline",
"(",
"TriConsumer",
"<",
"T1",
",",
"T2",
",",
"T3",
">",
"first",
",",
"TriConsumer",
"<",
"T1",
",",
"T2",
",",
"T3",
"... | Creates a pipeline from three ternary actions.
@param <T1> the consumer first parameter type
@param <T2> the consumer second parameter type
@param <T3> the consumer third parameter type
@param first the first consumer
@param second the second consumer
@param third the third consumer
@return the pipelined consumer | [
"Creates",
"a",
"pipeline",
"from",
"three",
"ternary",
"actions",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Pipelines.java#L244-L246 | train |
jcuda/jcusparse | JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java | JCusparse.initialize | public static void initialize()
{
if (!initialized)
{
String libraryBaseName = "JCusparse-" + JCuda.getJCudaVersion();
String libraryName =
LibUtils.createPlatformLibraryName(libraryBaseName);
LibUtils.loadLibrary(libraryName);
initialized = true;
}
} | java | public static void initialize()
{
if (!initialized)
{
String libraryBaseName = "JCusparse-" + JCuda.getJCudaVersion();
String libraryName =
LibUtils.createPlatformLibraryName(libraryBaseName);
LibUtils.loadLibrary(libraryName);
initialized = true;
}
} | [
"public",
"static",
"void",
"initialize",
"(",
")",
"{",
"if",
"(",
"!",
"initialized",
")",
"{",
"String",
"libraryBaseName",
"=",
"\"JCusparse-\"",
"+",
"JCuda",
".",
"getJCudaVersion",
"(",
")",
";",
"String",
"libraryName",
"=",
"LibUtils",
".",
"createP... | Initializes the native library. Note that this method
does not have to be called explicitly, since it will
be called automatically when this class is loaded. | [
"Initializes",
"the",
"native",
"library",
".",
"Note",
"that",
"this",
"method",
"does",
"not",
"have",
"to",
"be",
"called",
"explicitly",
"since",
"it",
"will",
"be",
"called",
"automatically",
"when",
"this",
"class",
"is",
"loaded",
"."
] | 7687a62a4ef6b76cb91cf7da93d4cf5ade96a791 | https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L70-L80 | train |
jcuda/jcusparse | JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java | JCusparse.checkResult | private static int checkResult(int result)
{
if (exceptionsEnabled && result !=
cusparseStatus.CUSPARSE_STATUS_SUCCESS)
{
throw new CudaException(cusparseStatus.stringFor(result));
}
return result;
} | java | private static int checkResult(int result)
{
if (exceptionsEnabled && result !=
cusparseStatus.CUSPARSE_STATUS_SUCCESS)
{
throw new CudaException(cusparseStatus.stringFor(result));
}
return result;
} | [
"private",
"static",
"int",
"checkResult",
"(",
"int",
"result",
")",
"{",
"if",
"(",
"exceptionsEnabled",
"&&",
"result",
"!=",
"cusparseStatus",
".",
"CUSPARSE_STATUS_SUCCESS",
")",
"{",
"throw",
"new",
"CudaException",
"(",
"cusparseStatus",
".",
"stringFor",
... | If the given result is not cusparseStatus.CUSPARSE_STATUS_SUCCESS
and exceptions have been enabled, this method will throw a
CudaException with an error message that corresponds to the
given result code. Otherwise, the given result is simply
returned.
@param result The result to check
@return The result that was given as the parameter
@throws CudaException If exceptions have been enabled and
the given result code is not cusparseStatus.CUSPARSE_STATUS_SUCCESS | [
"If",
"the",
"given",
"result",
"is",
"not",
"cusparseStatus",
".",
"CUSPARSE_STATUS_SUCCESS",
"and",
"exceptions",
"have",
"been",
"enabled",
"this",
"method",
"will",
"throw",
"a",
"CudaException",
"with",
"an",
"error",
"message",
"that",
"corresponds",
"to",
... | 7687a62a4ef6b76cb91cf7da93d4cf5ade96a791 | https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L128-L136 | train |
jcuda/jcusparse | JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java | JCusparse.cusparseCsrmvEx_bufferSize | public static int cusparseCsrmvEx_bufferSize(
cusparseHandle handle,
int alg,
int transA,
int m,
int n,
int nnz,
Pointer alpha,
int alphatype,
cusparseMatDescr descrA,
Pointer csrValA,
int csrValAtype,
Pointer csrRowPtrA,
Pointer csrColIndA,
Pointer x,
int xtype,
Pointer beta,
int betatype,
Pointer y,
int ytype,
int executiontype,
long[] bufferSizeInBytes)
{
return checkResult(cusparseCsrmvEx_bufferSizeNative(handle, alg, transA, m, n, nnz, alpha, alphatype, descrA, csrValA, csrValAtype, csrRowPtrA, csrColIndA, x, xtype, beta, betatype, y, ytype, executiontype, bufferSizeInBytes));
} | java | public static int cusparseCsrmvEx_bufferSize(
cusparseHandle handle,
int alg,
int transA,
int m,
int n,
int nnz,
Pointer alpha,
int alphatype,
cusparseMatDescr descrA,
Pointer csrValA,
int csrValAtype,
Pointer csrRowPtrA,
Pointer csrColIndA,
Pointer x,
int xtype,
Pointer beta,
int betatype,
Pointer y,
int ytype,
int executiontype,
long[] bufferSizeInBytes)
{
return checkResult(cusparseCsrmvEx_bufferSizeNative(handle, alg, transA, m, n, nnz, alpha, alphatype, descrA, csrValA, csrValAtype, csrRowPtrA, csrColIndA, x, xtype, beta, betatype, y, ytype, executiontype, bufferSizeInBytes));
} | [
"public",
"static",
"int",
"cusparseCsrmvEx_bufferSize",
"(",
"cusparseHandle",
"handle",
",",
"int",
"alg",
",",
"int",
"transA",
",",
"int",
"m",
",",
"int",
"n",
",",
"int",
"nnz",
",",
"Pointer",
"alpha",
",",
"int",
"alphatype",
",",
"cusparseMatDescr",... | Returns number of bytes | [
"Returns",
"number",
"of",
"bytes"
] | 7687a62a4ef6b76cb91cf7da93d4cf5ade96a791 | https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L1488-L1512 | train |
kuali/kc-api | coeus-api-all/src/main/java/org/kuali/coeus/sys/api/model/AbstractDecimal.java | AbstractDecimal.add | public T add(T addend) {
if (addend == null) {
throw new IllegalArgumentException("invalid (null) addend");
}
BigDecimal sum = this.value.add(addend.value);
return newInstance(sum, sum.scale());
} | java | public T add(T addend) {
if (addend == null) {
throw new IllegalArgumentException("invalid (null) addend");
}
BigDecimal sum = this.value.add(addend.value);
return newInstance(sum, sum.scale());
} | [
"public",
"T",
"add",
"(",
"T",
"addend",
")",
"{",
"if",
"(",
"addend",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"invalid (null) addend\"",
")",
";",
"}",
"BigDecimal",
"sum",
"=",
"this",
".",
"value",
".",
"add",
"(",... | Wraps BigDecimal's add method to accept and return T instances instead of
BigDecimals, so that users of the class don't have to typecast the return
value.
@param addend the value to add
@return result of adding the given addend to this value
@throws IllegalArgumentException if the given addend is null | [
"Wraps",
"BigDecimal",
"s",
"add",
"method",
"to",
"accept",
"and",
"return",
"T",
"instances",
"instead",
"of",
"BigDecimals",
"so",
"that",
"users",
"of",
"the",
"class",
"don",
"t",
"have",
"to",
"typecast",
"the",
"return",
"value",
"."
] | e04cf3194af9279d842747dd5610156cce00dba2 | https://github.com/kuali/kc-api/blob/e04cf3194af9279d842747dd5610156cce00dba2/coeus-api-all/src/main/java/org/kuali/coeus/sys/api/model/AbstractDecimal.java#L263-L270 | train |
kuali/kc-api | coeus-api-all/src/main/java/org/kuali/coeus/sys/api/model/AbstractDecimal.java | AbstractDecimal.subtract | public T subtract(T subtrahend) {
if (subtrahend == null) {
throw new IllegalArgumentException("invalid (null) subtrahend");
}
BigDecimal difference = this.value.subtract(subtrahend.value);
return newInstance(difference, difference.scale());
} | java | public T subtract(T subtrahend) {
if (subtrahend == null) {
throw new IllegalArgumentException("invalid (null) subtrahend");
}
BigDecimal difference = this.value.subtract(subtrahend.value);
return newInstance(difference, difference.scale());
} | [
"public",
"T",
"subtract",
"(",
"T",
"subtrahend",
")",
"{",
"if",
"(",
"subtrahend",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"invalid (null) subtrahend\"",
")",
";",
"}",
"BigDecimal",
"difference",
"=",
"this",
".",
"value"... | Wraps BigDecimal's subtract method to accept and return T instances
instead of BigDecimals, so that users of the class don't have to typecast
the return value.
@param subtrahend the value to subtract
@return result of the subtracting the given subtrahend from this value
@throws IllegalArgumentException if the given subtrahend is null | [
"Wraps",
"BigDecimal",
"s",
"subtract",
"method",
"to",
"accept",
"and",
"return",
"T",
"instances",
"instead",
"of",
"BigDecimals",
"so",
"that",
"users",
"of",
"the",
"class",
"don",
"t",
"have",
"to",
"typecast",
"the",
"return",
"value",
"."
] | e04cf3194af9279d842747dd5610156cce00dba2 | https://github.com/kuali/kc-api/blob/e04cf3194af9279d842747dd5610156cce00dba2/coeus-api-all/src/main/java/org/kuali/coeus/sys/api/model/AbstractDecimal.java#L281-L288 | train |
kuali/kc-api | coeus-api-all/src/main/java/org/kuali/coeus/sys/api/model/AbstractDecimal.java | AbstractDecimal.multiply | public T multiply(T multiplier) {
if (multiplier == null) {
throw new IllegalArgumentException("invalid (null) multiplier");
}
BigDecimal product = this.value.multiply(multiplier.value);
return newInstance(product, this.value.scale());
} | java | public T multiply(T multiplier) {
if (multiplier == null) {
throw new IllegalArgumentException("invalid (null) multiplier");
}
BigDecimal product = this.value.multiply(multiplier.value);
return newInstance(product, this.value.scale());
} | [
"public",
"T",
"multiply",
"(",
"T",
"multiplier",
")",
"{",
"if",
"(",
"multiplier",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"invalid (null) multiplier\"",
")",
";",
"}",
"BigDecimal",
"product",
"=",
"this",
".",
"value",
... | Wraps BigDecimal's multiply method to accept and return T instances
instead of BigDecimals, so that users of the class don't have to typecast
the return value.
@param multiplier the value to multiply
@return result of multiplying this value by the given multiplier
@throws IllegalArgumentException if the given multiplier is null | [
"Wraps",
"BigDecimal",
"s",
"multiply",
"method",
"to",
"accept",
"and",
"return",
"T",
"instances",
"instead",
"of",
"BigDecimals",
"so",
"that",
"users",
"of",
"the",
"class",
"don",
"t",
"have",
"to",
"typecast",
"the",
"return",
"value",
"."
] | e04cf3194af9279d842747dd5610156cce00dba2 | https://github.com/kuali/kc-api/blob/e04cf3194af9279d842747dd5610156cce00dba2/coeus-api-all/src/main/java/org/kuali/coeus/sys/api/model/AbstractDecimal.java#L299-L306 | train |
kuali/kc-api | coeus-api-all/src/main/java/org/kuali/coeus/sys/api/model/AbstractDecimal.java | AbstractDecimal.mod | public T mod(T modulus) {
if (modulus == null) {
throw new IllegalArgumentException("invalid (null) modulus");
}
double difference = this.value.doubleValue() % modulus.doubleValue();
return newInstance(BigDecimal.valueOf(difference), this.value.scale());
} | java | public T mod(T modulus) {
if (modulus == null) {
throw new IllegalArgumentException("invalid (null) modulus");
}
double difference = this.value.doubleValue() % modulus.doubleValue();
return newInstance(BigDecimal.valueOf(difference), this.value.scale());
} | [
"public",
"T",
"mod",
"(",
"T",
"modulus",
")",
"{",
"if",
"(",
"modulus",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"invalid (null) modulus\"",
")",
";",
"}",
"double",
"difference",
"=",
"this",
".",
"value",
".",
"double... | This method calculates the mod between to T values by first casting to
doubles and then by performing the % operation on the two primitives.
@param modulus
The other value to apply the mod to.
@return result of performing the mod calculation
@throws IllegalArgumentException if the given modulus is null | [
"This",
"method",
"calculates",
"the",
"mod",
"between",
"to",
"T",
"values",
"by",
"first",
"casting",
"to",
"doubles",
"and",
"then",
"by",
"performing",
"the",
"%",
"operation",
"on",
"the",
"two",
"primitives",
"."
] | e04cf3194af9279d842747dd5610156cce00dba2 | https://github.com/kuali/kc-api/blob/e04cf3194af9279d842747dd5610156cce00dba2/coeus-api-all/src/main/java/org/kuali/coeus/sys/api/model/AbstractDecimal.java#L317-L323 | train |
kuali/kc-api | coeus-api-all/src/main/java/org/kuali/coeus/sys/api/model/AbstractDecimal.java | AbstractDecimal.divide | public T divide(T divisor) {
if (divisor == null) {
throw new IllegalArgumentException("invalid (null) divisor");
}
BigDecimal quotient = this.value.divide(divisor.value, ROUND_BEHAVIOR);
return newInstance(quotient, this.value.scale());
} | java | public T divide(T divisor) {
if (divisor == null) {
throw new IllegalArgumentException("invalid (null) divisor");
}
BigDecimal quotient = this.value.divide(divisor.value, ROUND_BEHAVIOR);
return newInstance(quotient, this.value.scale());
} | [
"public",
"T",
"divide",
"(",
"T",
"divisor",
")",
"{",
"if",
"(",
"divisor",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"invalid (null) divisor\"",
")",
";",
"}",
"BigDecimal",
"quotient",
"=",
"this",
".",
"value",
".",
"d... | Wraps BigDecimal's divide method to enforce the default rounding
behavior
@param divisor the value to divide by
@return result of dividing this value by the given divisor
@throws IllegalArgumentException if the given divisor is null | [
"Wraps",
"BigDecimal",
"s",
"divide",
"method",
"to",
"enforce",
"the",
"default",
"rounding",
"behavior"
] | e04cf3194af9279d842747dd5610156cce00dba2 | https://github.com/kuali/kc-api/blob/e04cf3194af9279d842747dd5610156cce00dba2/coeus-api-all/src/main/java/org/kuali/coeus/sys/api/model/AbstractDecimal.java#L333-L340 | train |
lesaint/damapping | core-parent/core/src/main/java/fr/javatronic/damapping/processor/sourcegenerator/MapperSourceGenerator.java | MapperSourceGenerator.computeExtendedInterfaces | private static List<DAType> computeExtendedInterfaces(List<DAInterface> interfaces) {
Optional<DAType> functionInterface = from(interfaces)
.filter(DAInterfacePredicates.isGuavaFunction())
.transform(toDAType())
.filter(notNull())
.first();
if (functionInterface.isPresent()) {
return Collections.singletonList(functionInterface.get());
}
return Collections.emptyList();
} | java | private static List<DAType> computeExtendedInterfaces(List<DAInterface> interfaces) {
Optional<DAType> functionInterface = from(interfaces)
.filter(DAInterfacePredicates.isGuavaFunction())
.transform(toDAType())
.filter(notNull())
.first();
if (functionInterface.isPresent()) {
return Collections.singletonList(functionInterface.get());
}
return Collections.emptyList();
} | [
"private",
"static",
"List",
"<",
"DAType",
">",
"computeExtendedInterfaces",
"(",
"List",
"<",
"DAInterface",
">",
"interfaces",
")",
"{",
"Optional",
"<",
"DAType",
">",
"functionInterface",
"=",
"from",
"(",
"interfaces",
")",
".",
"filter",
"(",
"DAInterfa... | The only interface that can be extended by the Mapper interface is Guava's Function interface. | [
"The",
"only",
"interface",
"that",
"can",
"be",
"extended",
"by",
"the",
"Mapper",
"interface",
"is",
"Guava",
"s",
"Function",
"interface",
"."
] | 357afa5866939fd2a18c09213975ffef4836f328 | https://github.com/lesaint/damapping/blob/357afa5866939fd2a18c09213975ffef4836f328/core-parent/core/src/main/java/fr/javatronic/damapping/processor/sourcegenerator/MapperSourceGenerator.java#L113-L123 | train |
davidcarboni/restolino | src/main/java/com/github/davidcarboni/restolino/reload/ClassReloader.java | ClassReloader.start | public static void start(String path) {
classMonitor = new ClassReloader(path);
Thread thread = new Thread(classMonitor, ClassReloader.class.getSimpleName());
thread.setDaemon(true);
thread.start();
} | java | public static void start(String path) {
classMonitor = new ClassReloader(path);
Thread thread = new Thread(classMonitor, ClassReloader.class.getSimpleName());
thread.setDaemon(true);
thread.start();
} | [
"public",
"static",
"void",
"start",
"(",
"String",
"path",
")",
"{",
"classMonitor",
"=",
"new",
"ClassReloader",
"(",
"path",
")",
";",
"Thread",
"thread",
"=",
"new",
"Thread",
"(",
"classMonitor",
",",
"ClassReloader",
".",
"class",
".",
"getSimpleName",... | Sets up and starts a monitor for the given path.
@param path The path to be monitored (including subfolders). | [
"Sets",
"up",
"and",
"starts",
"a",
"monitor",
"for",
"the",
"given",
"path",
"."
] | 3f84ece1bd016fbb597c624d46fcca5a2580a33d | https://github.com/davidcarboni/restolino/blob/3f84ece1bd016fbb597c624d46fcca5a2580a33d/src/main/java/com/github/davidcarboni/restolino/reload/ClassReloader.java#L28-L33 | train |
davidcarboni/restolino | src/main/java/com/github/davidcarboni/restolino/helpers/Parameter.java | Parameter.toInteger | public static Integer toInteger(String parameterValue) {
Integer result = null;
if (isDigits(parameterValue))
result = Integer.valueOf(parameterValue);
return result;
} | java | public static Integer toInteger(String parameterValue) {
Integer result = null;
if (isDigits(parameterValue))
result = Integer.valueOf(parameterValue);
return result;
} | [
"public",
"static",
"Integer",
"toInteger",
"(",
"String",
"parameterValue",
")",
"{",
"Integer",
"result",
"=",
"null",
";",
"if",
"(",
"isDigits",
"(",
"parameterValue",
")",
")",
"result",
"=",
"Integer",
".",
"valueOf",
"(",
"parameterValue",
")",
";",
... | Parses a parameter as an Integer. This is useful for working with query
string parameters and path segments as numbers.
@param parameterValue The String to parse.
@return If the string is made up of digits only, an Integer parsed from
the string. Otherwise null. | [
"Parses",
"a",
"parameter",
"as",
"an",
"Integer",
".",
"This",
"is",
"useful",
"for",
"working",
"with",
"query",
"string",
"parameters",
"and",
"path",
"segments",
"as",
"numbers",
"."
] | 3f84ece1bd016fbb597c624d46fcca5a2580a33d | https://github.com/davidcarboni/restolino/blob/3f84ece1bd016fbb597c624d46fcca5a2580a33d/src/main/java/com/github/davidcarboni/restolino/helpers/Parameter.java#L33-L38 | train |
davidcarboni/restolino | src/main/java/com/github/davidcarboni/restolino/helpers/Parameter.java | Parameter.toInt | public static int toInt(String parameterValue) {
int result = -1;
if (isDigits(parameterValue))
result = Integer.parseInt(parameterValue);
return result;
} | java | public static int toInt(String parameterValue) {
int result = -1;
if (isDigits(parameterValue))
result = Integer.parseInt(parameterValue);
return result;
} | [
"public",
"static",
"int",
"toInt",
"(",
"String",
"parameterValue",
")",
"{",
"int",
"result",
"=",
"-",
"1",
";",
"if",
"(",
"isDigits",
"(",
"parameterValue",
")",
")",
"result",
"=",
"Integer",
".",
"parseInt",
"(",
"parameterValue",
")",
";",
"retur... | Parses a parameter as an int. This is useful for working with query
string parameters and path segments as numbers.
@param parameterValue The String to parse.
@return If the string is made up of digits only, an int parsed from the
string. Otherwise -1. | [
"Parses",
"a",
"parameter",
"as",
"an",
"int",
".",
"This",
"is",
"useful",
"for",
"working",
"with",
"query",
"string",
"parameters",
"and",
"path",
"segments",
"as",
"numbers",
"."
] | 3f84ece1bd016fbb597c624d46fcca5a2580a33d | https://github.com/davidcarboni/restolino/blob/3f84ece1bd016fbb597c624d46fcca5a2580a33d/src/main/java/com/github/davidcarboni/restolino/helpers/Parameter.java#L48-L53 | train |
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",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/post/Adresse.java#L187-L192 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/post/Adresse.java | Adresse.getStrasseKurz | public String getStrasseKurz() {
if (PATTERN_STRASSE.matcher(strasse).matches()) {
return strasse.substring(0, StringUtils.lastIndexOfIgnoreCase(strasse, "stra") + 3) + '.';
} else {
return strasse;
}
} | java | public String getStrasseKurz() {
if (PATTERN_STRASSE.matcher(strasse).matches()) {
return strasse.substring(0, StringUtils.lastIndexOfIgnoreCase(strasse, "stra") + 3) + '.';
} else {
return strasse;
}
} | [
"public",
"String",
"getStrasseKurz",
"(",
")",
"{",
"if",
"(",
"PATTERN_STRASSE",
".",
"matcher",
"(",
"strasse",
")",
".",
"matches",
"(",
")",
")",
"{",
"return",
"strasse",
".",
"substring",
"(",
"0",
",",
"StringUtils",
".",
"lastIndexOfIgnoreCase",
"... | Liefert die Strasse in einer abgekuerzten Schreibweise.
@return z.B. "Badstr." | [
"Liefert",
"die",
"Strasse",
"in",
"einer",
"abgekuerzten",
"Schreibweise",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/post/Adresse.java#L301-L307 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/post/Adresse.java | Adresse.toMap | @Override
public Map<String, Object> toMap() {
Map<String, Object> map = new HashMap<>();
map.put("plz", getPLZ());
map.put("ortsname", getOrtsname());
map.put("strasse", getStrasse());
map.put("hausnummer", getHausnummer());
return map;
} | java | @Override
public Map<String, Object> toMap() {
Map<String, Object> map = new HashMap<>();
map.put("plz", getPLZ());
map.put("ortsname", getOrtsname());
map.put("strasse", getStrasse());
map.put("hausnummer", getHausnummer());
return map;
} | [
"@",
"Override",
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"toMap",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"map",
".",
"put",
"(",
"\"plz\"",
",",
"getPLZ",
"(",
")",
... | Liefert die einzelnen Attribute einer Adresse als Map.
@return Attribute als Map | [
"Liefert",
"die",
"einzelnen",
"Attribute",
"einer",
"Adresse",
"als",
"Map",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/post/Adresse.java#L421-L429 | train |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/mappingconfig/DatamappingHelper.java | DatamappingHelper.findDataMapping | public static Datamappingtype findDataMapping(Object data, String id, Datamappingstype dataMappingConfig) {
if (null != data) {
Class clazz = (Class) ((data instanceof Class) ? data : data.getClass());
for (Datamappingtype dt : dataMappingConfig.getDatamapping()) {
if (dt.isRegex() && Pattern.compile(dt.getClassname()).matcher(clazz.getName()).find() && idOK(id, dt.getId())) {
if (logger.isLoggable(Level.FINE)) {
logger.fine(String.format("Datamapping found: %s matches regex %s (requested id: %s)", clazz.getName(), dt.getClassname(), id));
}
return dt;
} else if (clazz.getName().equals(dt.getClassname()) && idOK(id, dt.getId())) {
if (logger.isLoggable(Level.FINE)) {
logger.fine(String.format("Datamapping found: %s matches %s (requested id: %s)", clazz.getName(), dt.getClassname(), id));
}
return dt;
}
if (logger.isLoggable(Level.FINE)) {
logger.fine(String.format("%s does not match %s (regex: %s, requested id %s)", dt.getClassname(), clazz.getName(), dt.isRegex(), id));
}
}
}
return null;
} | java | public static Datamappingtype findDataMapping(Object data, String id, Datamappingstype dataMappingConfig) {
if (null != data) {
Class clazz = (Class) ((data instanceof Class) ? data : data.getClass());
for (Datamappingtype dt : dataMappingConfig.getDatamapping()) {
if (dt.isRegex() && Pattern.compile(dt.getClassname()).matcher(clazz.getName()).find() && idOK(id, dt.getId())) {
if (logger.isLoggable(Level.FINE)) {
logger.fine(String.format("Datamapping found: %s matches regex %s (requested id: %s)", clazz.getName(), dt.getClassname(), id));
}
return dt;
} else if (clazz.getName().equals(dt.getClassname()) && idOK(id, dt.getId())) {
if (logger.isLoggable(Level.FINE)) {
logger.fine(String.format("Datamapping found: %s matches %s (requested id: %s)", clazz.getName(), dt.getClassname(), id));
}
return dt;
}
if (logger.isLoggable(Level.FINE)) {
logger.fine(String.format("%s does not match %s (regex: %s, requested id %s)", dt.getClassname(), clazz.getName(), dt.isRegex(), id));
}
}
}
return null;
} | [
"public",
"static",
"Datamappingtype",
"findDataMapping",
"(",
"Object",
"data",
",",
"String",
"id",
",",
"Datamappingstype",
"dataMappingConfig",
")",
"{",
"if",
"(",
"null",
"!=",
"data",
")",
"{",
"Class",
"clazz",
"=",
"(",
"Class",
")",
"(",
"(",
"da... | returns the first Datamapping found for an object or Class. A datamapping is valid for an object when either a
regex is found in the classname of the object or the classname of the object equals the configured classname, when
an id is provided the id in the datamapping found must match this id, when an id is not provided an id a
datamapping with an id is not valid.
@param data the object or class for which a data mapping is searched
@param id an optional id that must be matched by the datamapping
@param dataMappingConfig
@return | [
"returns",
"the",
"first",
"Datamapping",
"found",
"for",
"an",
"object",
"or",
"Class",
".",
"A",
"datamapping",
"is",
"valid",
"for",
"an",
"object",
"when",
"either",
"a",
"regex",
"is",
"found",
"in",
"the",
"classname",
"of",
"the",
"object",
"or",
... | b5fb7a89e16d9b35f557f3bf620594f821fa1552 | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/mappingconfig/DatamappingHelper.java#L163-L184 | train |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/mappingconfig/DatamappingHelper.java | DatamappingHelper.getContainers | public static List<StartContainerConfig> getContainers(Class clazz) {
if (!cacheSCC.containsKey(clazz)) {
cacheSCC.put(clazz, new ArrayList<>(1));
ContainerStart cs = (ContainerStart) clazz.getAnnotation(ContainerStart.class);
if (cs != null) {
cacheSCC.get(clazz).add(fromContainerStart(cs));
}
Containers c = (Containers) clazz.getAnnotation(com.vectorprint.report.itext.annotations.Containers.class);
if (c != null) {
for (ContainerStart s : c.containers()) {
cacheSCC.get(clazz).add(fromContainerStart(s));
}
}
}
return cacheSCC.get(clazz);
} | java | public static List<StartContainerConfig> getContainers(Class clazz) {
if (!cacheSCC.containsKey(clazz)) {
cacheSCC.put(clazz, new ArrayList<>(1));
ContainerStart cs = (ContainerStart) clazz.getAnnotation(ContainerStart.class);
if (cs != null) {
cacheSCC.get(clazz).add(fromContainerStart(cs));
}
Containers c = (Containers) clazz.getAnnotation(com.vectorprint.report.itext.annotations.Containers.class);
if (c != null) {
for (ContainerStart s : c.containers()) {
cacheSCC.get(clazz).add(fromContainerStart(s));
}
}
}
return cacheSCC.get(clazz);
} | [
"public",
"static",
"List",
"<",
"StartContainerConfig",
">",
"getContainers",
"(",
"Class",
"clazz",
")",
"{",
"if",
"(",
"!",
"cacheSCC",
".",
"containsKey",
"(",
"clazz",
")",
")",
"{",
"cacheSCC",
".",
"put",
"(",
"clazz",
",",
"new",
"ArrayList",
"<... | Find a datamapping to start a container based on class annotation, uses static cache.
@param clazz
@return | [
"Find",
"a",
"datamapping",
"to",
"start",
"a",
"container",
"based",
"on",
"class",
"annotation",
"uses",
"static",
"cache",
"."
] | b5fb7a89e16d9b35f557f3bf620594f821fa1552 | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/mappingconfig/DatamappingHelper.java#L199-L214 | train |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/mappingconfig/DatamappingHelper.java | DatamappingHelper.getElements | public static List<ElementConfig> getElements(Class clazz) {
if (!cacheEC.containsKey(clazz)) {
cacheEC.put(clazz, new ArrayList<>(1));
Element e = (Element) clazz.getAnnotation(Element.class);
if (e != null) {
cacheEC.get(clazz).add(fromAnnotation(e));
}
Elements es = (Elements) clazz.getAnnotation(com.vectorprint.report.itext.annotations.Elements.class);
if (es != null) {
for (Element s : es.elements()) {
cacheEC.get(clazz).add(fromAnnotation(s));
}
}
}
return cacheEC.get(clazz);
} | java | public static List<ElementConfig> getElements(Class clazz) {
if (!cacheEC.containsKey(clazz)) {
cacheEC.put(clazz, new ArrayList<>(1));
Element e = (Element) clazz.getAnnotation(Element.class);
if (e != null) {
cacheEC.get(clazz).add(fromAnnotation(e));
}
Elements es = (Elements) clazz.getAnnotation(com.vectorprint.report.itext.annotations.Elements.class);
if (es != null) {
for (Element s : es.elements()) {
cacheEC.get(clazz).add(fromAnnotation(s));
}
}
}
return cacheEC.get(clazz);
} | [
"public",
"static",
"List",
"<",
"ElementConfig",
">",
"getElements",
"(",
"Class",
"clazz",
")",
"{",
"if",
"(",
"!",
"cacheEC",
".",
"containsKey",
"(",
"clazz",
")",
")",
"{",
"cacheEC",
".",
"put",
"(",
"clazz",
",",
"new",
"ArrayList",
"<>",
"(",
... | Find a datamapping to create an element based on class annotation, uses static cache.
@param clazz
@return | [
"Find",
"a",
"datamapping",
"to",
"create",
"an",
"element",
"based",
"on",
"class",
"annotation",
"uses",
"static",
"cache",
"."
] | b5fb7a89e16d9b35f557f3bf620594f821fa1552 | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/mappingconfig/DatamappingHelper.java#L252-L267 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/bank/IBAN.java | IBAN.getFormatted | public String getFormatted() {
String input = this.getUnformatted() + " ";
StringBuilder buf = new StringBuilder();
for (int i = 0; i < this.getUnformatted().length(); i+= 4) {
buf.append(input, i, i+4);
buf.append(' ');
}
return buf.toString().trim();
} | java | public String getFormatted() {
String input = this.getUnformatted() + " ";
StringBuilder buf = new StringBuilder();
for (int i = 0; i < this.getUnformatted().length(); i+= 4) {
buf.append(input, i, i+4);
buf.append(' ');
}
return buf.toString().trim();
} | [
"public",
"String",
"getFormatted",
"(",
")",
"{",
"String",
"input",
"=",
"this",
".",
"getUnformatted",
"(",
")",
"+",
"\" \"",
";",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"... | Liefert die IBAN formattiert in der DIN-Form. Dies ist die uebliche
Papierform, in der die IBAN in 4er-Bloecke formattiert wird, jeweils
durch Leerzeichen getrennt.
@return formatierte IBAN, z.B. "DE19 1234 1234 1234 1234 12" | [
"Liefert",
"die",
"IBAN",
"formattiert",
"in",
"der",
"DIN",
"-",
"Form",
".",
"Dies",
"ist",
"die",
"uebliche",
"Papierform",
"in",
"der",
"die",
"IBAN",
"in",
"4er",
"-",
"Bloecke",
"formattiert",
"wird",
"jeweils",
"durch",
"Leerzeichen",
"getrennt",
"."
... | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/bank/IBAN.java#L107-L115 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/bank/IBAN.java | IBAN.getLand | @SuppressWarnings({"squid:SwitchLastCaseIsDefaultCheck", "squid:S1301"})
public Locale getLand() {
String country = this.getUnformatted().substring(0, 2);
String language = country.toLowerCase();
switch (country) {
case "AT":
case "CH":
language = "de";
break;
}
return new Locale(language, country);
} | java | @SuppressWarnings({"squid:SwitchLastCaseIsDefaultCheck", "squid:S1301"})
public Locale getLand() {
String country = this.getUnformatted().substring(0, 2);
String language = country.toLowerCase();
switch (country) {
case "AT":
case "CH":
language = "de";
break;
}
return new Locale(language, country);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"squid:SwitchLastCaseIsDefaultCheck\"",
",",
"\"squid:S1301\"",
"}",
")",
"public",
"Locale",
"getLand",
"(",
")",
"{",
"String",
"country",
"=",
"this",
".",
"getUnformatted",
"(",
")",
".",
"substring",
"(",
"0",
",",
"2"... | Liefert das Land, zu dem die IBAN gehoert.
@return z.B. "de_DE" (als Locale)
@since 0.1.0 | [
"Liefert",
"das",
"Land",
"zu",
"dem",
"die",
"IBAN",
"gehoert",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/bank/IBAN.java#L132-L143 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/FachwertFactory.java | FachwertFactory.getFachwert | public Fachwert getFachwert(Class<? extends Fachwert> clazz, Object... args) {
Class[] argTypes = toTypes(args);
try {
Constructor<? extends Fachwert> ctor = clazz.getConstructor(argTypes);
return ctor.newInstance(args);
} catch (ReflectiveOperationException ex) {
Throwable cause = ex.getCause();
if (cause instanceof ValidationException) {
throw (ValidationException) cause;
} else if (cause instanceof IllegalArgumentException) {
throw new LocalizedValidationException(cause.getMessage(), cause);
} else {
throw new IllegalArgumentException("cannot create " + clazz + " with " + Arrays.toString(args), ex);
}
}
} | java | public Fachwert getFachwert(Class<? extends Fachwert> clazz, Object... args) {
Class[] argTypes = toTypes(args);
try {
Constructor<? extends Fachwert> ctor = clazz.getConstructor(argTypes);
return ctor.newInstance(args);
} catch (ReflectiveOperationException ex) {
Throwable cause = ex.getCause();
if (cause instanceof ValidationException) {
throw (ValidationException) cause;
} else if (cause instanceof IllegalArgumentException) {
throw new LocalizedValidationException(cause.getMessage(), cause);
} else {
throw new IllegalArgumentException("cannot create " + clazz + " with " + Arrays.toString(args), ex);
}
}
} | [
"public",
"Fachwert",
"getFachwert",
"(",
"Class",
"<",
"?",
"extends",
"Fachwert",
">",
"clazz",
",",
"Object",
"...",
"args",
")",
"{",
"Class",
"[",
"]",
"argTypes",
"=",
"toTypes",
"(",
"args",
")",
";",
"try",
"{",
"Constructor",
"<",
"?",
"extend... | Liefert einen Fachwert zur angegebenen Klasse.
@param clazz Fachwert-Klasse
@param args Argument(e) fuer den Konstruktor der Fachwert-Klasse
@return ein Fachwert | [
"Liefert",
"einen",
"Fachwert",
"zur",
"angegebenen",
"Klasse",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/FachwertFactory.java#L181-L196 | train |
isisaddons-legacy/isis-module-docx | dom/src/main/java/org/isisaddons/module/docx/dom/DocxService.java | DocxService.loadPackage | @Programmatic
public WordprocessingMLPackage loadPackage(final InputStream docxTemplate) throws LoadTemplateException {
final WordprocessingMLPackage docxPkg;
try {
docxPkg = WordprocessingMLPackage.load(docxTemplate);
} catch (final Docx4JException ex) {
throw new LoadTemplateException("Unable to load docx template from input stream", ex);
}
return docxPkg;
} | java | @Programmatic
public WordprocessingMLPackage loadPackage(final InputStream docxTemplate) throws LoadTemplateException {
final WordprocessingMLPackage docxPkg;
try {
docxPkg = WordprocessingMLPackage.load(docxTemplate);
} catch (final Docx4JException ex) {
throw new LoadTemplateException("Unable to load docx template from input stream", ex);
}
return docxPkg;
} | [
"@",
"Programmatic",
"public",
"WordprocessingMLPackage",
"loadPackage",
"(",
"final",
"InputStream",
"docxTemplate",
")",
"throws",
"LoadTemplateException",
"{",
"final",
"WordprocessingMLPackage",
"docxPkg",
";",
"try",
"{",
"docxPkg",
"=",
"WordprocessingMLPackage",
".... | Load and return an in-memory representation of a docx.
<p>
This is public API because building the in-memory structure can be
quite slow. Thus, clients can use this method to cache the in-memory
structure, and pass in to either
{@link #merge(String, WordprocessingMLPackage, OutputStream, MatchingPolicy)}
or {@link #merge(org.w3c.dom.Document, org.docx4j.openpackaging.packages.WordprocessingMLPackage, java.io.OutputStream, org.isisaddons.module.docx.dom.DocxService.MatchingPolicy, org.isisaddons.module.docx.dom.DocxService.OutputType)} | [
"Load",
"and",
"return",
"an",
"in",
"-",
"memory",
"representation",
"of",
"a",
"docx",
"."
] | f2cabcc42fff46c593c2ecbb0bda1d2364bf3c2a | https://github.com/isisaddons-legacy/isis-module-docx/blob/f2cabcc42fff46c593c2ecbb0bda1d2364bf3c2a/dom/src/main/java/org/isisaddons/module/docx/dom/DocxService.java#L104-L113 | train |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/style/stylers/AbstractFieldStyler.java | AbstractFieldStyler.makeField | @Override
public PdfFormField makeField() throws IOException, DocumentException, VectorPrintException {
switch (getFieldtype()) {
case TEXT:
return ((TextField) bf).getTextField();
case COMBO:
return ((TextField) bf).getComboField();
case LIST:
return ((TextField) bf).getListField();
case BUTTON:
return ((PushbuttonField) bf).getField();
case CHECKBOX:
return ((RadioCheckField) bf).getCheckField();
case RADIO:
return ((RadioCheckField) bf).getRadioField();
}
throw new VectorPrintException(String.format("cannot create pdfformfield from %s and %s", (bf != null) ? bf.getClass() : null, String.valueOf(getFieldtype())));
} | java | @Override
public PdfFormField makeField() throws IOException, DocumentException, VectorPrintException {
switch (getFieldtype()) {
case TEXT:
return ((TextField) bf).getTextField();
case COMBO:
return ((TextField) bf).getComboField();
case LIST:
return ((TextField) bf).getListField();
case BUTTON:
return ((PushbuttonField) bf).getField();
case CHECKBOX:
return ((RadioCheckField) bf).getCheckField();
case RADIO:
return ((RadioCheckField) bf).getRadioField();
}
throw new VectorPrintException(String.format("cannot create pdfformfield from %s and %s", (bf != null) ? bf.getClass() : null, String.valueOf(getFieldtype())));
} | [
"@",
"Override",
"public",
"PdfFormField",
"makeField",
"(",
")",
"throws",
"IOException",
",",
"DocumentException",
",",
"VectorPrintException",
"{",
"switch",
"(",
"getFieldtype",
"(",
")",
")",
"{",
"case",
"TEXT",
":",
"return",
"(",
"(",
"TextField",
")",... | Create the PdfFormField that will be used to add a form field to the pdf.
@return
@throws IOException
@throws DocumentException
@throws VectorPrintException | [
"Create",
"the",
"PdfFormField",
"that",
"will",
"be",
"used",
"to",
"add",
"a",
"form",
"field",
"to",
"the",
"pdf",
"."
] | b5fb7a89e16d9b35f557f3bf620594f821fa1552 | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/style/stylers/AbstractFieldStyler.java#L222-L240 | train |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/Help.java | Help.getParameterizables | public static <P extends Parameterizable> Set<P> getParameterizables(Package javaPackage, Class<P> clazz) throws IOException, FileNotFoundException, ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
Set<P> parameterizables = new HashSet<>(50);
for (Class<?> c : ClassHelper.fromPackage(javaPackage)) {
if (clazz.isAssignableFrom(c) && !Modifier.isAbstract(c.getModifiers())) {
P p = (P) c.newInstance();
ParamAnnotationProcessor.PAP.initParameters(p);
parameterizables.add(p);
}
}
return parameterizables;
} | java | public static <P extends Parameterizable> Set<P> getParameterizables(Package javaPackage, Class<P> clazz) throws IOException, FileNotFoundException, ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
Set<P> parameterizables = new HashSet<>(50);
for (Class<?> c : ClassHelper.fromPackage(javaPackage)) {
if (clazz.isAssignableFrom(c) && !Modifier.isAbstract(c.getModifiers())) {
P p = (P) c.newInstance();
ParamAnnotationProcessor.PAP.initParameters(p);
parameterizables.add(p);
}
}
return parameterizables;
} | [
"public",
"static",
"<",
"P",
"extends",
"Parameterizable",
">",
"Set",
"<",
"P",
">",
"getParameterizables",
"(",
"Package",
"javaPackage",
",",
"Class",
"<",
"P",
">",
"clazz",
")",
"throws",
"IOException",
",",
"FileNotFoundException",
",",
"ClassNotFoundExce... | Use this generic method in for example a gui that supports building a styling file.
@param <P>
@param javaPackage
@param clazz
@return
@throws IOException
@throws FileNotFoundException
@throws ClassNotFoundException
@throws InstantiationException
@throws IllegalAccessException
@throws NoSuchMethodException
@throws InvocationTargetException | [
"Use",
"this",
"generic",
"method",
"in",
"for",
"example",
"a",
"gui",
"that",
"supports",
"building",
"a",
"styling",
"file",
"."
] | b5fb7a89e16d9b35f557f3bf620594f821fa1552 | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/Help.java#L190-L200 | train |
panossot/jam-metrics | ApplicationMetricsSubsystem/metrics/src/main/java/org/jam/metrics/subsystem/deployment/JamMetricsDependencyProcessor.java | JamMetricsDependencyProcessor.deploy | @Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
final ModuleLoader moduleLoader = Module.getBootModuleLoader();
// ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
// final VirtualFile rootBeansXml = deploymentRoot.getRoot().getChild("META-INF/beans.xml");
// final boolean rootBeansXmlPresent = rootBeansXml.exists() && rootBeansXml.isFile();
// System.out.println("rootBeansXmlPresent " + rootBeansXmlPresent);
/* Map<ResourceRoot, ExplicitBeanArchiveMetadata> beanArchiveMetadata = new HashMap<>();
PropertyReplacingBeansXmlParser parser = new PropertyReplacingBeansXmlParser(deploymentUnit);
ResourceRoot classesRoot = null;
List<ResourceRoot> structure = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS);
for (ResourceRoot resourceRoot : structure) {
if (ModuleRootMarker.isModuleRoot(resourceRoot) && !SubDeploymentMarker.isSubDeployment(resourceRoot)) {
if (resourceRoot.getRootName().equals("classes")) {
// hack for dealing with war modules
classesRoot = resourceRoot;
deploymentUnit.putAttachment(WeldAttachments.CLASSES_RESOURCE_ROOT, resourceRoot);
} else {
VirtualFile beansXml = resourceRoot.getRoot().getChild("META-INF/beans.xml");
if (beansXml.exists() && beansXml.isFile()) {
System.out.println("rootBeansXmlPresent found");
beanArchiveMetadata.put(resourceRoot, new ExplicitBeanArchiveMetadata(beansXml, resourceRoot, parseBeansXml(beansXml, parser, deploymentUnit), false));
}
}
}
}
*/
// BeansXml beansXml = deployment.getBeanDeploymentArchive().getBeansXml();
if (!WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) {
return; // Skip if there are no beans.xml files in the deployment
}
ModuleDependency dep = new ModuleDependency(moduleLoader, ORG_JAM_METRICS, false, false, true, false);
dep.addImportFilter(PathFilters.getMetaInfFilter(), true);
dep.addExportFilter(PathFilters.getMetaInfFilter(), true);
moduleSpecification.addSystemDependency(dep);
ModuleDependency dep2 = new ModuleDependency(moduleLoader, ORG_JAM_METRICS_API, false, false, true, false);
dep2.addImportFilter(PathFilters.getMetaInfFilter(), true);
dep2.addExportFilter(PathFilters.getMetaInfFilter(), true);
moduleSpecification.addSystemDependency(dep2);
ModuleDependency dep3 = new ModuleDependency(moduleLoader, ORG_JAM_METRICS_PROPERTIES, false, false, true, false);
dep3.addImportFilter(PathFilters.getMetaInfFilter(), true);
dep3.addExportFilter(PathFilters.getMetaInfFilter(), true);
moduleSpecification.addSystemDependency(dep3);
ModuleDependency dep4 = new ModuleDependency(moduleLoader, ORG_JAM_METRICS_LIBRARY, false, false, true, false);
dep4.addImportFilter(PathFilters.getMetaInfFilter(), true);
dep4.addExportFilter(PathFilters.getMetaInfFilter(), true);
moduleSpecification.addSystemDependency(dep4);
ModuleDependency dep5 = new ModuleDependency(moduleLoader, ORG_JAM_METRICS_LIBRARY2, false, false, true, false);
dep5.addImportFilter(PathFilters.getMetaInfFilter(), true);
dep5.addExportFilter(PathFilters.getMetaInfFilter(), true);
moduleSpecification.addSystemDependency(dep5);
} | java | @Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
final ModuleLoader moduleLoader = Module.getBootModuleLoader();
// ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
// final VirtualFile rootBeansXml = deploymentRoot.getRoot().getChild("META-INF/beans.xml");
// final boolean rootBeansXmlPresent = rootBeansXml.exists() && rootBeansXml.isFile();
// System.out.println("rootBeansXmlPresent " + rootBeansXmlPresent);
/* Map<ResourceRoot, ExplicitBeanArchiveMetadata> beanArchiveMetadata = new HashMap<>();
PropertyReplacingBeansXmlParser parser = new PropertyReplacingBeansXmlParser(deploymentUnit);
ResourceRoot classesRoot = null;
List<ResourceRoot> structure = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS);
for (ResourceRoot resourceRoot : structure) {
if (ModuleRootMarker.isModuleRoot(resourceRoot) && !SubDeploymentMarker.isSubDeployment(resourceRoot)) {
if (resourceRoot.getRootName().equals("classes")) {
// hack for dealing with war modules
classesRoot = resourceRoot;
deploymentUnit.putAttachment(WeldAttachments.CLASSES_RESOURCE_ROOT, resourceRoot);
} else {
VirtualFile beansXml = resourceRoot.getRoot().getChild("META-INF/beans.xml");
if (beansXml.exists() && beansXml.isFile()) {
System.out.println("rootBeansXmlPresent found");
beanArchiveMetadata.put(resourceRoot, new ExplicitBeanArchiveMetadata(beansXml, resourceRoot, parseBeansXml(beansXml, parser, deploymentUnit), false));
}
}
}
}
*/
// BeansXml beansXml = deployment.getBeanDeploymentArchive().getBeansXml();
if (!WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) {
return; // Skip if there are no beans.xml files in the deployment
}
ModuleDependency dep = new ModuleDependency(moduleLoader, ORG_JAM_METRICS, false, false, true, false);
dep.addImportFilter(PathFilters.getMetaInfFilter(), true);
dep.addExportFilter(PathFilters.getMetaInfFilter(), true);
moduleSpecification.addSystemDependency(dep);
ModuleDependency dep2 = new ModuleDependency(moduleLoader, ORG_JAM_METRICS_API, false, false, true, false);
dep2.addImportFilter(PathFilters.getMetaInfFilter(), true);
dep2.addExportFilter(PathFilters.getMetaInfFilter(), true);
moduleSpecification.addSystemDependency(dep2);
ModuleDependency dep3 = new ModuleDependency(moduleLoader, ORG_JAM_METRICS_PROPERTIES, false, false, true, false);
dep3.addImportFilter(PathFilters.getMetaInfFilter(), true);
dep3.addExportFilter(PathFilters.getMetaInfFilter(), true);
moduleSpecification.addSystemDependency(dep3);
ModuleDependency dep4 = new ModuleDependency(moduleLoader, ORG_JAM_METRICS_LIBRARY, false, false, true, false);
dep4.addImportFilter(PathFilters.getMetaInfFilter(), true);
dep4.addExportFilter(PathFilters.getMetaInfFilter(), true);
moduleSpecification.addSystemDependency(dep4);
ModuleDependency dep5 = new ModuleDependency(moduleLoader, ORG_JAM_METRICS_LIBRARY2, false, false, true, false);
dep5.addImportFilter(PathFilters.getMetaInfFilter(), true);
dep5.addExportFilter(PathFilters.getMetaInfFilter(), true);
moduleSpecification.addSystemDependency(dep5);
} | [
"@",
"Override",
"public",
"void",
"deploy",
"(",
"DeploymentPhaseContext",
"phaseContext",
")",
"throws",
"DeploymentUnitProcessingException",
"{",
"final",
"DeploymentUnit",
"deploymentUnit",
"=",
"phaseContext",
".",
"getDeploymentUnit",
"(",
")",
";",
"final",
"Modu... | Add dependencies for modules required for metric deployments | [
"Add",
"dependencies",
"for",
"modules",
"required",
"for",
"metric",
"deployments"
] | 1818633304dca731d4beaf6c5d4f000e8a88d725 | https://github.com/panossot/jam-metrics/blob/1818633304dca731d4beaf6c5d4f000e8a88d725/ApplicationMetricsSubsystem/metrics/src/main/java/org/jam/metrics/subsystem/deployment/JamMetricsDependencyProcessor.java#L54-L114 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/bank/internal/WaehrungenSingletonSpi.java | WaehrungenSingletonSpi.getDefaultProviderChain | @Override
public List<String> getDefaultProviderChain() {
List<String> list = new ArrayList<>(getProviderNames());
return list;
} | java | @Override
public List<String> getDefaultProviderChain() {
List<String> list = new ArrayList<>(getProviderNames());
return list;
} | [
"@",
"Override",
"public",
"List",
"<",
"String",
">",
"getDefaultProviderChain",
"(",
")",
"{",
"List",
"<",
"String",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
"getProviderNames",
"(",
")",
")",
";",
"return",
"list",
";",
"}"
] | Access a list of the currently registered default providers. The default providers are used, when
no provider names are passed by the caller.
@return the currencies returned by the given provider chain. If not provider names are provided
the default provider chain configured in {@code javamoney.properties} is used.
@see #getCurrencies(String...)
@see CurrencyQueryBuilder | [
"Access",
"a",
"list",
"of",
"the",
"currently",
"registered",
"default",
"providers",
".",
"The",
"default",
"providers",
"are",
"used",
"when",
"no",
"provider",
"names",
"are",
"passed",
"by",
"the",
"caller",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/bank/internal/WaehrungenSingletonSpi.java#L52-L56 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/bank/internal/WaehrungenSingletonSpi.java | WaehrungenSingletonSpi.getCurrencies | @Override
public Set<CurrencyUnit> getCurrencies(CurrencyQuery query) {
Set<CurrencyUnit> result = new HashSet<>();
for (Locale locale : query.getCountries()) {
try {
result.add(Waehrung.of(Currency.getInstance(locale)));
} catch (IllegalArgumentException ex) {
LOG.log(Level.WARNING, "Cannot get currency for locale '" + locale + "':", ex);
}
}
for (String currencyCode : query.getCurrencyCodes()) {
try {
result.add(Waehrung.of(currencyCode));
} catch (IllegalArgumentException ex) {
LOG.log(Level.WARNING, "Cannot get currency '" + currencyCode + "':", ex);
}
}
for (CurrencyProviderSpi spi : Bootstrap.getServices(CurrencyProviderSpi.class)) {
result.addAll(spi.getCurrencies(query));
}
return result;
} | java | @Override
public Set<CurrencyUnit> getCurrencies(CurrencyQuery query) {
Set<CurrencyUnit> result = new HashSet<>();
for (Locale locale : query.getCountries()) {
try {
result.add(Waehrung.of(Currency.getInstance(locale)));
} catch (IllegalArgumentException ex) {
LOG.log(Level.WARNING, "Cannot get currency for locale '" + locale + "':", ex);
}
}
for (String currencyCode : query.getCurrencyCodes()) {
try {
result.add(Waehrung.of(currencyCode));
} catch (IllegalArgumentException ex) {
LOG.log(Level.WARNING, "Cannot get currency '" + currencyCode + "':", ex);
}
}
for (CurrencyProviderSpi spi : Bootstrap.getServices(CurrencyProviderSpi.class)) {
result.addAll(spi.getCurrencies(query));
}
return result;
} | [
"@",
"Override",
"public",
"Set",
"<",
"CurrencyUnit",
">",
"getCurrencies",
"(",
"CurrencyQuery",
"query",
")",
"{",
"Set",
"<",
"CurrencyUnit",
">",
"result",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"for",
"(",
"Locale",
"locale",
":",
"query",
"."... | Access all currencies matching the given query.
@param query The currency query, not null.
@return a set of all currencies found, never null. | [
"Access",
"all",
"currencies",
"matching",
"the",
"given",
"query",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/bank/internal/WaehrungenSingletonSpi.java#L80-L101 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Consumers.java | Consumers.all | public static <E> List<E> all(E[] array) {
final Function<Iterator<E>, ArrayList<E>> consumer = new ConsumeIntoCollection<>(new ArrayListFactory<E>());
return consumer.apply(new ArrayIterator<>(array));
} | java | public static <E> List<E> all(E[] array) {
final Function<Iterator<E>, ArrayList<E>> consumer = new ConsumeIntoCollection<>(new ArrayListFactory<E>());
return consumer.apply(new ArrayIterator<>(array));
} | [
"public",
"static",
"<",
"E",
">",
"List",
"<",
"E",
">",
"all",
"(",
"E",
"[",
"]",
"array",
")",
"{",
"final",
"Function",
"<",
"Iterator",
"<",
"E",
">",
",",
"ArrayList",
"<",
"E",
">",
">",
"consumer",
"=",
"new",
"ConsumeIntoCollection",
"<>"... | Yields all element of the array in a list.
@param <E> the array element type
@param array the array that will be consumed
@return a list filled with array values | [
"Yields",
"all",
"element",
"of",
"the",
"array",
"in",
"a",
"list",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Consumers.java#L164-L167 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Consumers.java | Consumers.dict | public static <K, V> Map<K, V> dict(Pair<K, V>... array) {
final Function<Iterator<Pair<K, V>>, HashMap<K, V>> consumer = new ConsumeIntoMap<>(new HashMapFactory<K, V>());
return consumer.apply(new ArrayIterator<>(array));
} | java | public static <K, V> Map<K, V> dict(Pair<K, V>... array) {
final Function<Iterator<Pair<K, V>>, HashMap<K, V>> consumer = new ConsumeIntoMap<>(new HashMapFactory<K, V>());
return consumer.apply(new ArrayIterator<>(array));
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Map",
"<",
"K",
",",
"V",
">",
"dict",
"(",
"Pair",
"<",
"K",
",",
"V",
">",
"...",
"array",
")",
"{",
"final",
"Function",
"<",
"Iterator",
"<",
"Pair",
"<",
"K",
",",
"V",
">",
">",
",",
"Hash... | Yields all element of the array in a map.
@param <K> the map key type
@param <V> the map value type
@param array the array that will be consumed
@return a map filled with array values | [
"Yields",
"all",
"element",
"of",
"the",
"array",
"in",
"a",
"map",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Consumers.java#L299-L302 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Consumers.java | Consumers.pipe | public static <E> void pipe(Iterator<E> iterator, OutputIterator<E> outputIterator) {
new ConsumeIntoOutputIterator<>(outputIterator).apply(iterator);
} | java | public static <E> void pipe(Iterator<E> iterator, OutputIterator<E> outputIterator) {
new ConsumeIntoOutputIterator<>(outputIterator).apply(iterator);
} | [
"public",
"static",
"<",
"E",
">",
"void",
"pipe",
"(",
"Iterator",
"<",
"E",
">",
"iterator",
",",
"OutputIterator",
"<",
"E",
">",
"outputIterator",
")",
"{",
"new",
"ConsumeIntoOutputIterator",
"<>",
"(",
"outputIterator",
")",
".",
"apply",
"(",
"itera... | Consumes the input iterator to the output iterator.
@param <E> the iterator element type
@param iterator the iterator that will be consumed
@param outputIterator the iterator that will be filled | [
"Consumes",
"the",
"input",
"iterator",
"to",
"the",
"output",
"iterator",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Consumers.java#L311-L313 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Consumers.java | Consumers.pipe | public static <E> void pipe(Iterable<E> iterable, OutputIterator<E> outputIterator) {
dbc.precondition(iterable != null, "cannot call pipe with a null iterable");
new ConsumeIntoOutputIterator<>(outputIterator).apply(iterable.iterator());
} | java | public static <E> void pipe(Iterable<E> iterable, OutputIterator<E> outputIterator) {
dbc.precondition(iterable != null, "cannot call pipe with a null iterable");
new ConsumeIntoOutputIterator<>(outputIterator).apply(iterable.iterator());
} | [
"public",
"static",
"<",
"E",
">",
"void",
"pipe",
"(",
"Iterable",
"<",
"E",
">",
"iterable",
",",
"OutputIterator",
"<",
"E",
">",
"outputIterator",
")",
"{",
"dbc",
".",
"precondition",
"(",
"iterable",
"!=",
"null",
",",
"\"cannot call pipe with a null i... | Consumes an iterable into the output iterator.
@param <E> the iterator element type
@param iterable the iterable that will be consumed
@param outputIterator the iterator that will be filled | [
"Consumes",
"an",
"iterable",
"into",
"the",
"output",
"iterator",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Consumers.java#L322-L325 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Consumers.java | Consumers.pipe | public static <E> void pipe(E[] array, OutputIterator<E> outputIterator) {
new ConsumeIntoOutputIterator<>(outputIterator).apply(new ArrayIterator<>(array));
} | java | public static <E> void pipe(E[] array, OutputIterator<E> outputIterator) {
new ConsumeIntoOutputIterator<>(outputIterator).apply(new ArrayIterator<>(array));
} | [
"public",
"static",
"<",
"E",
">",
"void",
"pipe",
"(",
"E",
"[",
"]",
"array",
",",
"OutputIterator",
"<",
"E",
">",
"outputIterator",
")",
"{",
"new",
"ConsumeIntoOutputIterator",
"<>",
"(",
"outputIterator",
")",
".",
"apply",
"(",
"new",
"ArrayIterator... | Consumes the array into the output iterator.
@param <E> the iterator element type
@param array the array that will be consumed
@param outputIterator the iterator that will be filled | [
"Consumes",
"the",
"array",
"into",
"the",
"output",
"iterator",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Consumers.java#L334-L336 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Consumers.java | Consumers.first | public static <E> E first(Iterator<E> iterator) {
return new FirstElement<E>().apply(iterator);
} | java | public static <E> E first(Iterator<E> iterator) {
return new FirstElement<E>().apply(iterator);
} | [
"public",
"static",
"<",
"E",
">",
"E",
"first",
"(",
"Iterator",
"<",
"E",
">",
"iterator",
")",
"{",
"return",
"new",
"FirstElement",
"<",
"E",
">",
"(",
")",
".",
"apply",
"(",
"iterator",
")",
";",
"}"
] | Yields the first element of the iterator.
@param <E> the element type parameter
@param iterator the iterator to be searched
@throws IllegalArgumentException if no element is present
@return the found element | [
"Yields",
"the",
"first",
"element",
"of",
"the",
"iterator",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Consumers.java#L380-L382 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Consumers.java | Consumers.first | public static <E> E first(Iterable<E> iterable) {
dbc.precondition(iterable != null, "cannot call first with a null iterable");
return new FirstElement<E>().apply(iterable.iterator());
} | java | public static <E> E first(Iterable<E> iterable) {
dbc.precondition(iterable != null, "cannot call first with a null iterable");
return new FirstElement<E>().apply(iterable.iterator());
} | [
"public",
"static",
"<",
"E",
">",
"E",
"first",
"(",
"Iterable",
"<",
"E",
">",
"iterable",
")",
"{",
"dbc",
".",
"precondition",
"(",
"iterable",
"!=",
"null",
",",
"\"cannot call first with a null iterable\"",
")",
";",
"return",
"new",
"FirstElement",
"<... | Yields the first element of the iterable.
@param <E> the element type parameter
@param iterable the iterable to be searched
@throws IllegalArgumentException if no element is present
@return the found element | [
"Yields",
"the",
"first",
"element",
"of",
"the",
"iterable",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Consumers.java#L392-L395 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Consumers.java | Consumers.first | public static <E> E first(E[] array) {
return new FirstElement<E>().apply(new ArrayIterator<>(array));
} | java | public static <E> E first(E[] array) {
return new FirstElement<E>().apply(new ArrayIterator<>(array));
} | [
"public",
"static",
"<",
"E",
">",
"E",
"first",
"(",
"E",
"[",
"]",
"array",
")",
"{",
"return",
"new",
"FirstElement",
"<",
"E",
">",
"(",
")",
".",
"apply",
"(",
"new",
"ArrayIterator",
"<>",
"(",
"array",
")",
")",
";",
"}"
] | Yields the first element of the array.
@param <E> the element type parameter
@param array the array to be searched
@throws IllegalArgumentException if no element matches
@return the found element | [
"Yields",
"the",
"first",
"element",
"of",
"the",
"array",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Consumers.java#L405-L407 | train |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java | DefaultElementProducer.createElementByStyler | public <E extends Element> E createElementByStyler(Collection<? extends BaseStyler> stylers, Object data, Class<E> clazz) throws VectorPrintException {
// pdfptable, Section and others do not have a default constructor, a styler creates it
E e = null;
return styleHelper.style(e, data, stylers);
} | java | public <E extends Element> E createElementByStyler(Collection<? extends BaseStyler> stylers, Object data, Class<E> clazz) throws VectorPrintException {
// pdfptable, Section and others do not have a default constructor, a styler creates it
E e = null;
return styleHelper.style(e, data, stylers);
} | [
"public",
"<",
"E",
"extends",
"Element",
">",
"E",
"createElementByStyler",
"(",
"Collection",
"<",
"?",
"extends",
"BaseStyler",
">",
"stylers",
",",
"Object",
"data",
",",
"Class",
"<",
"E",
">",
"clazz",
")",
"throws",
"VectorPrintException",
"{",
"// pd... | leaves object creation to the first styler in the list
@param <E>
@param stylers
@param data
@param clazz
@return
@throws VectorPrintException | [
"leaves",
"object",
"creation",
"to",
"the",
"first",
"styler",
"in",
"the",
"list"
] | b5fb7a89e16d9b35f557f3bf620594f821fa1552 | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java#L133-L138 | train |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java | DefaultElementProducer.createPhrase | public Phrase createPhrase(Object data, Collection<? extends BaseStyler> stylers) throws VectorPrintException {
return initTextElementArray(styleHelper.style(new Phrase(Float.NaN), data, stylers), data, stylers);
} | java | public Phrase createPhrase(Object data, Collection<? extends BaseStyler> stylers) throws VectorPrintException {
return initTextElementArray(styleHelper.style(new Phrase(Float.NaN), data, stylers), data, stylers);
} | [
"public",
"Phrase",
"createPhrase",
"(",
"Object",
"data",
",",
"Collection",
"<",
"?",
"extends",
"BaseStyler",
">",
"stylers",
")",
"throws",
"VectorPrintException",
"{",
"return",
"initTextElementArray",
"(",
"styleHelper",
".",
"style",
"(",
"new",
"Phrase",
... | Create a Phrase, style it and add the data
@param data
@param stylers
@return
@throws VectorPrintException | [
"Create",
"a",
"Phrase",
"style",
"it",
"and",
"add",
"the",
"data"
] | b5fb7a89e16d9b35f557f3bf620594f821fa1552 | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java#L213-L215 | train |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java | DefaultElementProducer.createParagraph | public Paragraph createParagraph(Object data, Collection<? extends BaseStyler> stylers) throws VectorPrintException {
return initTextElementArray(styleHelper.style(new Paragraph(Float.NaN), data, stylers), data, stylers);
} | java | public Paragraph createParagraph(Object data, Collection<? extends BaseStyler> stylers) throws VectorPrintException {
return initTextElementArray(styleHelper.style(new Paragraph(Float.NaN), data, stylers), data, stylers);
} | [
"public",
"Paragraph",
"createParagraph",
"(",
"Object",
"data",
",",
"Collection",
"<",
"?",
"extends",
"BaseStyler",
">",
"stylers",
")",
"throws",
"VectorPrintException",
"{",
"return",
"initTextElementArray",
"(",
"styleHelper",
".",
"style",
"(",
"new",
"Para... | Create a Paragraph, style it and add the data
@param data
@param stylers
@return
@throws VectorPrintException | [
"Create",
"a",
"Paragraph",
"style",
"it",
"and",
"add",
"the",
"data"
] | b5fb7a89e16d9b35f557f3bf620594f821fa1552 | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java#L225-L227 | train |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java | DefaultElementProducer.createAnchor | public Anchor createAnchor(Object data, Collection<? extends BaseStyler> stylers) throws VectorPrintException {
return initTextElementArray(styleHelper.style(new Anchor(Float.NaN), data, stylers), data, stylers);
} | java | public Anchor createAnchor(Object data, Collection<? extends BaseStyler> stylers) throws VectorPrintException {
return initTextElementArray(styleHelper.style(new Anchor(Float.NaN), data, stylers), data, stylers);
} | [
"public",
"Anchor",
"createAnchor",
"(",
"Object",
"data",
",",
"Collection",
"<",
"?",
"extends",
"BaseStyler",
">",
"stylers",
")",
"throws",
"VectorPrintException",
"{",
"return",
"initTextElementArray",
"(",
"styleHelper",
".",
"style",
"(",
"new",
"Anchor",
... | Create a Anchor, style it and add the data
@param data
@param stylers
@return
@throws VectorPrintException | [
"Create",
"a",
"Anchor",
"style",
"it",
"and",
"add",
"the",
"data"
] | b5fb7a89e16d9b35f557f3bf620594f821fa1552 | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java#L237-L239 | train |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java | DefaultElementProducer.createListItem | public ListItem createListItem(Object data, Collection<? extends BaseStyler> stylers) throws VectorPrintException {
return initTextElementArray(styleHelper.style(new ListItem(Float.NaN), data, stylers), data, stylers);
} | java | public ListItem createListItem(Object data, Collection<? extends BaseStyler> stylers) throws VectorPrintException {
return initTextElementArray(styleHelper.style(new ListItem(Float.NaN), data, stylers), data, stylers);
} | [
"public",
"ListItem",
"createListItem",
"(",
"Object",
"data",
",",
"Collection",
"<",
"?",
"extends",
"BaseStyler",
">",
"stylers",
")",
"throws",
"VectorPrintException",
"{",
"return",
"initTextElementArray",
"(",
"styleHelper",
".",
"style",
"(",
"new",
"ListIt... | Create a ListItem, style it and add the data
@param data
@param stylers
@return
@throws VectorPrintException | [
"Create",
"a",
"ListItem",
"style",
"it",
"and",
"add",
"the",
"data"
] | b5fb7a89e16d9b35f557f3bf620594f821fa1552 | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java#L249-L251 | train |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java | DefaultElementProducer.makeImageTranslucent | public static BufferedImage makeImageTranslucent(BufferedImage source, float opacity) {
if (opacity == 1) {
return source;
}
BufferedImage translucent = new BufferedImage(source.getWidth(), source.getHeight(), BufferedImage.TRANSLUCENT);
Graphics2D g = translucent.createGraphics();
g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, opacity));
g.drawImage(source, null, 0, 0);
g.dispose();
return translucent;
} | java | public static BufferedImage makeImageTranslucent(BufferedImage source, float opacity) {
if (opacity == 1) {
return source;
}
BufferedImage translucent = new BufferedImage(source.getWidth(), source.getHeight(), BufferedImage.TRANSLUCENT);
Graphics2D g = translucent.createGraphics();
g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, opacity));
g.drawImage(source, null, 0, 0);
g.dispose();
return translucent;
} | [
"public",
"static",
"BufferedImage",
"makeImageTranslucent",
"(",
"BufferedImage",
"source",
",",
"float",
"opacity",
")",
"{",
"if",
"(",
"opacity",
"==",
"1",
")",
"{",
"return",
"source",
";",
"}",
"BufferedImage",
"translucent",
"=",
"new",
"BufferedImage",
... | returns a transparent image when opacity < 1
@param source
@param opacity
@return | [
"returns",
"a",
"transparent",
"image",
"when",
"opacity",
"<",
";",
"1"
] | b5fb7a89e16d9b35f557f3bf620594f821fa1552 | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java#L426-L436 | train |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java | DefaultElementProducer.getIndex | @Override
public Section getIndex(String title, int nesting, List<? extends BaseStyler> stylers) throws VectorPrintException, InstantiationException, IllegalAccessException {
if (nesting < 1) {
throw new VectorPrintException("chapter numbering starts with 1, wrong number: " + nesting);
}
if (sections.get(nesting) == null) {
sections.put(nesting, new ArrayList<>(10));
}
Section current;
if (nesting == 1) {
List<Section> chapters = sections.get(1);
current = new Chapter(createElement(title, Paragraph.class, stylers), chapters.size() + 1);
chapters.add(current);
} else {
List<Section> parents = sections.get(nesting - 1);
Section parent = parents.get(parents.size() - 1);
current = parent.addSection(createParagraph(title, stylers));
sections.get(nesting).add(current);
}
return styleHelper.style(current, null, stylers);
} | java | @Override
public Section getIndex(String title, int nesting, List<? extends BaseStyler> stylers) throws VectorPrintException, InstantiationException, IllegalAccessException {
if (nesting < 1) {
throw new VectorPrintException("chapter numbering starts with 1, wrong number: " + nesting);
}
if (sections.get(nesting) == null) {
sections.put(nesting, new ArrayList<>(10));
}
Section current;
if (nesting == 1) {
List<Section> chapters = sections.get(1);
current = new Chapter(createElement(title, Paragraph.class, stylers), chapters.size() + 1);
chapters.add(current);
} else {
List<Section> parents = sections.get(nesting - 1);
Section parent = parents.get(parents.size() - 1);
current = parent.addSection(createParagraph(title, stylers));
sections.get(nesting).add(current);
}
return styleHelper.style(current, null, stylers);
} | [
"@",
"Override",
"public",
"Section",
"getIndex",
"(",
"String",
"title",
",",
"int",
"nesting",
",",
"List",
"<",
"?",
"extends",
"BaseStyler",
">",
"stylers",
")",
"throws",
"VectorPrintException",
",",
"InstantiationException",
",",
"IllegalAccessException",
"{... | create the Section, style the title, style the section and return the styled section.
@param title
@param nesting
@param stylers
@return
@throws VectorPrintException
@throws InstantiationException
@throws IllegalAccessException | [
"create",
"the",
"Section",
"style",
"the",
"title",
"style",
"the",
"section",
"and",
"return",
"the",
"styled",
"section",
"."
] | b5fb7a89e16d9b35f557f3bf620594f821fa1552 | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java#L592-L612 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/support/ComposableVisitor.java | ComposableVisitor.visit | public void visit(Visitable visitable) {
StreamSupport.stream(this.spliterator(), false).forEach(visitor -> visitor.visit(visitable));
} | java | public void visit(Visitable visitable) {
StreamSupport.stream(this.spliterator(), false).forEach(visitor -> visitor.visit(visitable));
} | [
"public",
"void",
"visit",
"(",
"Visitable",
"visitable",
")",
"{",
"StreamSupport",
".",
"stream",
"(",
"this",
".",
"spliterator",
"(",
")",
",",
"false",
")",
".",
"forEach",
"(",
"visitor",
"->",
"visitor",
".",
"visit",
"(",
"visitable",
")",
")",
... | Visits the given Visitable object in order to carryout some function or investigation of the targeted object.
@param visitable the Visitable object visited by this Visitor. | [
"Visits",
"the",
"given",
"Visitable",
"object",
"in",
"order",
"to",
"carryout",
"some",
"function",
"or",
"investigation",
"of",
"the",
"targeted",
"object",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/support/ComposableVisitor.java#L134-L136 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/br_broker/br_broker.java | br_broker.reboot | public static br_broker reboot(nitro_service client, br_broker resource) throws Exception
{
return ((br_broker[]) resource.perform_operation(client, "reboot"))[0];
} | java | public static br_broker reboot(nitro_service client, br_broker resource) throws Exception
{
return ((br_broker[]) resource.perform_operation(client, "reboot"))[0];
} | [
"public",
"static",
"br_broker",
"reboot",
"(",
"nitro_service",
"client",
",",
"br_broker",
"resource",
")",
"throws",
"Exception",
"{",
"return",
"(",
"(",
"br_broker",
"[",
"]",
")",
"resource",
".",
"perform_operation",
"(",
"client",
",",
"\"reboot\"",
")... | Use this operation to reboot Unified Repeater Instance. | [
"Use",
"this",
"operation",
"to",
"reboot",
"Unified",
"Repeater",
"Instance",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/br_broker/br_broker.java#L317-L320 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/br_broker/br_broker.java | br_broker.stop | public static br_broker stop(nitro_service client, br_broker resource) throws Exception
{
return ((br_broker[]) resource.perform_operation(client, "stop"))[0];
} | java | public static br_broker stop(nitro_service client, br_broker resource) throws Exception
{
return ((br_broker[]) resource.perform_operation(client, "stop"))[0];
} | [
"public",
"static",
"br_broker",
"stop",
"(",
"nitro_service",
"client",
",",
"br_broker",
"resource",
")",
"throws",
"Exception",
"{",
"return",
"(",
"(",
"br_broker",
"[",
"]",
")",
"resource",
".",
"perform_operation",
"(",
"client",
",",
"\"stop\"",
")",
... | Use this operation to stop Unified Repeater Instance. | [
"Use",
"this",
"operation",
"to",
"stop",
"Unified",
"Repeater",
"Instance",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/br_broker/br_broker.java#L348-L351 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.