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/Pagination.java | Pagination.page | public static <T> Pair<Integer, List<T>> page(long start, long howMany, Iterable<T> iterable) {
dbc.precondition(iterable != null, "cannot call page with a null iterable");
return Pagination.page(start, howMany, iterable.iterator());
} | java | public static <T> Pair<Integer, List<T>> page(long start, long howMany, Iterable<T> iterable) {
dbc.precondition(iterable != null, "cannot call page with a null iterable");
return Pagination.page(start, howMany, iterable.iterator());
} | [
"public",
"static",
"<",
"T",
">",
"Pair",
"<",
"Integer",
",",
"List",
"<",
"T",
">",
">",
"page",
"(",
"long",
"start",
",",
"long",
"howMany",
",",
"Iterable",
"<",
"T",
">",
"iterable",
")",
"{",
"dbc",
".",
"precondition",
"(",
"iterable",
"!=... | Creates a page view of an iterable.
@param <T> the element type parameter
@param start the index where the page starts
@param howMany the page size
@param iterable the iterable to be sliced
@return a pair containing the iterator size and the requested page | [
"Creates",
"a",
"page",
"view",
"of",
"an",
"iterable",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Pagination.java#L60-L63 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Pagination.java | Pagination.page | public static <T, C extends Collection<T>> Pair<Integer, C> page(long start, long howMany, Iterable<T> iterable, C collection) {
dbc.precondition(iterable != null, "cannot call page with a null iterable");
return Pagination.page(start, howMany, iterable.iterator(), collection);
} | java | public static <T, C extends Collection<T>> Pair<Integer, C> page(long start, long howMany, Iterable<T> iterable, C collection) {
dbc.precondition(iterable != null, "cannot call page with a null iterable");
return Pagination.page(start, howMany, iterable.iterator(), collection);
} | [
"public",
"static",
"<",
"T",
",",
"C",
"extends",
"Collection",
"<",
"T",
">",
">",
"Pair",
"<",
"Integer",
",",
"C",
">",
"page",
"(",
"long",
"start",
",",
"long",
"howMany",
",",
"Iterable",
"<",
"T",
">",
"iterable",
",",
"C",
"collection",
")... | Creates a page view of an iterable adding elements to the collection.
@param <T> the element type parameter
@param <C> the collection type parameter
@param start the index where the page starts
@param howMany the page size
@param iterable the iterable to be sliced
@param collection the output collection
@return a pair containing the iterator size and the requested page | [
"Creates",
"a",
"page",
"view",
"of",
"an",
"iterable",
"adding",
"elements",
"to",
"the",
"collection",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Pagination.java#L76-L79 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Pagination.java | Pagination.page | public static <T> Pair<Integer, List<T>> page(long start, long howMany, T[] array) {
return Pagination.page(start, howMany, new ArrayIterator<T>(array));
} | java | public static <T> Pair<Integer, List<T>> page(long start, long howMany, T[] array) {
return Pagination.page(start, howMany, new ArrayIterator<T>(array));
} | [
"public",
"static",
"<",
"T",
">",
"Pair",
"<",
"Integer",
",",
"List",
"<",
"T",
">",
">",
"page",
"(",
"long",
"start",
",",
"long",
"howMany",
",",
"T",
"[",
"]",
"array",
")",
"{",
"return",
"Pagination",
".",
"page",
"(",
"start",
",",
"howM... | Creates a page view of an array.
@param <T> the element type parameter
@param start the index where the page starts
@param howMany the page size
@param array the array to be sliced
@return a pair containing the iterator size and the requested page | [
"Creates",
"a",
"page",
"view",
"of",
"an",
"array",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Pagination.java#L90-L92 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Pagination.java | Pagination.page | public static <T, C extends Collection<T>> Pair<Integer, C> page(long start, long howMany, T[] array, C collection) {
return Pagination.page(start, howMany, new ArrayIterator<T>(array), collection);
} | java | public static <T, C extends Collection<T>> Pair<Integer, C> page(long start, long howMany, T[] array, C collection) {
return Pagination.page(start, howMany, new ArrayIterator<T>(array), collection);
} | [
"public",
"static",
"<",
"T",
",",
"C",
"extends",
"Collection",
"<",
"T",
">",
">",
"Pair",
"<",
"Integer",
",",
"C",
">",
"page",
"(",
"long",
"start",
",",
"long",
"howMany",
",",
"T",
"[",
"]",
"array",
",",
"C",
"collection",
")",
"{",
"retu... | Creates a page view of an array adding elements to the collection.
@param <T> the element type parameter
@param <C> the collection type parameter
@param start the index where the page starts
@param howMany the page size
@param array the array to be sliced
@param collection the output collection
@return a pair containing the iterator size and the requested page | [
"Creates",
"a",
"page",
"view",
"of",
"an",
"array",
"adding",
"elements",
"to",
"the",
"collection",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Pagination.java#L105-L107 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Pagination.java | Pagination.page | public static <T> Pair<Integer, List<T>> page(long start, long howMany, Collection<T> collection) {
return Pair.of(collection.size(), Consumers.all(Filtering.slice(start, howMany, collection)));
} | java | public static <T> Pair<Integer, List<T>> page(long start, long howMany, Collection<T> collection) {
return Pair.of(collection.size(), Consumers.all(Filtering.slice(start, howMany, collection)));
} | [
"public",
"static",
"<",
"T",
">",
"Pair",
"<",
"Integer",
",",
"List",
"<",
"T",
">",
">",
"page",
"(",
"long",
"start",
",",
"long",
"howMany",
",",
"Collection",
"<",
"T",
">",
"collection",
")",
"{",
"return",
"Pair",
".",
"of",
"(",
"collectio... | Creates a page view of a collection.
@param <T> the element type parameter
@param start the index where the page starts
@param howMany the page size
@param collection the iterable to be sliced
@return a pair containing the iterator size and the requested page | [
"Creates",
"a",
"page",
"view",
"of",
"a",
"collection",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Pagination.java#L118-L120 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Pagination.java | Pagination.page | public static <T, C extends Collection<T>> Pair<Integer, C> page(long start, long howMany, Collection<T> in, C out) {
return Pair.of(in.size(), Consumers.all(Filtering.slice(start, howMany, in), out));
} | java | public static <T, C extends Collection<T>> Pair<Integer, C> page(long start, long howMany, Collection<T> in, C out) {
return Pair.of(in.size(), Consumers.all(Filtering.slice(start, howMany, in), out));
} | [
"public",
"static",
"<",
"T",
",",
"C",
"extends",
"Collection",
"<",
"T",
">",
">",
"Pair",
"<",
"Integer",
",",
"C",
">",
"page",
"(",
"long",
"start",
",",
"long",
"howMany",
",",
"Collection",
"<",
"T",
">",
"in",
",",
"C",
"out",
")",
"{",
... | Creates a page view of a collection adding elements to the out
collection.
@param <T> the element type parameter
@param <C> the collection type parameter
@param start the index where the page starts
@param howMany the page size
@param in the iterable to be sliced
@param out the output collection
@return a pair containing the iterator size and the requested page | [
"Creates",
"a",
"page",
"view",
"of",
"a",
"collection",
"adding",
"elements",
"to",
"the",
"out",
"collection",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Pagination.java#L134-L136 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/math/Primzahl.java | Primzahl.after | public static Primzahl after(int zahl) {
List<Primzahl> primzahlen = getPrimzahlen();
for (Primzahl p : primzahlen) {
if (zahl < p.intValue()) {
return p;
}
}
for (int n = primzahlen.get(primzahlen.size() - 1).intValue() + 2; n <= zahl; n += 2) {
if (!hasTeiler(n)) {
primzahlen.add(new Primzahl(n));
}
}
int n = primzahlen.get(primzahlen.size() - 1).intValue() + 2;
while (hasTeiler(n)) {
n += 2;
}
Primzahl nextPrimzahl = new Primzahl(n);
primzahlen.add(nextPrimzahl);
return nextPrimzahl;
} | java | public static Primzahl after(int zahl) {
List<Primzahl> primzahlen = getPrimzahlen();
for (Primzahl p : primzahlen) {
if (zahl < p.intValue()) {
return p;
}
}
for (int n = primzahlen.get(primzahlen.size() - 1).intValue() + 2; n <= zahl; n += 2) {
if (!hasTeiler(n)) {
primzahlen.add(new Primzahl(n));
}
}
int n = primzahlen.get(primzahlen.size() - 1).intValue() + 2;
while (hasTeiler(n)) {
n += 2;
}
Primzahl nextPrimzahl = new Primzahl(n);
primzahlen.add(nextPrimzahl);
return nextPrimzahl;
} | [
"public",
"static",
"Primzahl",
"after",
"(",
"int",
"zahl",
")",
"{",
"List",
"<",
"Primzahl",
">",
"primzahlen",
"=",
"getPrimzahlen",
"(",
")",
";",
"for",
"(",
"Primzahl",
"p",
":",
"primzahlen",
")",
"{",
"if",
"(",
"zahl",
"<",
"p",
".",
"intVa... | Liefert die naechste Primzahl nach der angegebenen Zahl.
@param zahl Zahl
@return naechste Primzahl > zahl | [
"Liefert",
"die",
"naechste",
"Primzahl",
"nach",
"der",
"angegebenen",
"Zahl",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/math/Primzahl.java#L143-L162 | train |
joaovicente/Tracy | src/main/java/com/apm4all/tracy/Tracy.java | Tracy.annotate | public static void annotate(String floatName, float floatValue) {
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx)) {
ctx.annotate(floatName, floatValue);
}
} | java | public static void annotate(String floatName, float floatValue) {
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx)) {
ctx.annotate(floatName, floatValue);
}
} | [
"public",
"static",
"void",
"annotate",
"(",
"String",
"floatName",
",",
"float",
"floatValue",
")",
"{",
"TracyThreadContext",
"ctx",
"=",
"threadContext",
".",
"get",
"(",
")",
";",
"if",
"(",
"isValidContext",
"(",
"ctx",
")",
")",
"{",
"ctx",
".",
"a... | Annotate a float value | [
"Annotate",
"a",
"float",
"value"
] | 822d3aa335c1801df25ae6e67c22466368de3747 | https://github.com/joaovicente/Tracy/blob/822d3aa335c1801df25ae6e67c22466368de3747/src/main/java/com/apm4all/tracy/Tracy.java#L144-L149 | train |
joaovicente/Tracy | src/main/java/com/apm4all/tracy/Tracy.java | Tracy.annotate | public static void annotate(String doubleName, double doubleValue) {
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx)) {
ctx.annotate(doubleName, doubleValue);
}
} | java | public static void annotate(String doubleName, double doubleValue) {
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx)) {
ctx.annotate(doubleName, doubleValue);
}
} | [
"public",
"static",
"void",
"annotate",
"(",
"String",
"doubleName",
",",
"double",
"doubleValue",
")",
"{",
"TracyThreadContext",
"ctx",
"=",
"threadContext",
".",
"get",
"(",
")",
";",
"if",
"(",
"isValidContext",
"(",
"ctx",
")",
")",
"{",
"ctx",
".",
... | Annotate a double value | [
"Annotate",
"a",
"double",
"value"
] | 822d3aa335c1801df25ae6e67c22466368de3747 | https://github.com/joaovicente/Tracy/blob/822d3aa335c1801df25ae6e67c22466368de3747/src/main/java/com/apm4all/tracy/Tracy.java#L155-L160 | train |
joaovicente/Tracy | src/main/java/com/apm4all/tracy/Tracy.java | Tracy.annotateRoot | public static void annotateRoot(String... keyValueSequence) {
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx)) {
ctx.annotateRoot(keyValueSequence);
}
} | java | public static void annotateRoot(String... keyValueSequence) {
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx)) {
ctx.annotateRoot(keyValueSequence);
}
} | [
"public",
"static",
"void",
"annotateRoot",
"(",
"String",
"...",
"keyValueSequence",
")",
"{",
"TracyThreadContext",
"ctx",
"=",
"threadContext",
".",
"get",
"(",
")",
";",
"if",
"(",
"isValidContext",
"(",
"ctx",
")",
")",
"{",
"ctx",
".",
"annotateRoot",
... | Annotate String values at the root Tracy frame | [
"Annotate",
"String",
"values",
"at",
"the",
"root",
"Tracy",
"frame"
] | 822d3aa335c1801df25ae6e67c22466368de3747 | https://github.com/joaovicente/Tracy/blob/822d3aa335c1801df25ae6e67c22466368de3747/src/main/java/com/apm4all/tracy/Tracy.java#L175-L180 | train |
joaovicente/Tracy | src/main/java/com/apm4all/tracy/Tracy.java | Tracy.annotateRoot | public static void annotateRoot(String intName, int intValue) {
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx)) {
ctx.annotateRoot(intName, intValue);
}
} | java | public static void annotateRoot(String intName, int intValue) {
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx)) {
ctx.annotateRoot(intName, intValue);
}
} | [
"public",
"static",
"void",
"annotateRoot",
"(",
"String",
"intName",
",",
"int",
"intValue",
")",
"{",
"TracyThreadContext",
"ctx",
"=",
"threadContext",
".",
"get",
"(",
")",
";",
"if",
"(",
"isValidContext",
"(",
"ctx",
")",
")",
"{",
"ctx",
".",
"ann... | Annotate an integer value at the root Tracy frame | [
"Annotate",
"an",
"integer",
"value",
"at",
"the",
"root",
"Tracy",
"frame"
] | 822d3aa335c1801df25ae6e67c22466368de3747 | https://github.com/joaovicente/Tracy/blob/822d3aa335c1801df25ae6e67c22466368de3747/src/main/java/com/apm4all/tracy/Tracy.java#L185-L190 | train |
joaovicente/Tracy | src/main/java/com/apm4all/tracy/Tracy.java | Tracy.annotateRoot | public static void annotateRoot(String longName, long longValue) {
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx)) {
ctx.annotateRoot(longName, longValue);
}
} | java | public static void annotateRoot(String longName, long longValue) {
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx)) {
ctx.annotateRoot(longName, longValue);
}
} | [
"public",
"static",
"void",
"annotateRoot",
"(",
"String",
"longName",
",",
"long",
"longValue",
")",
"{",
"TracyThreadContext",
"ctx",
"=",
"threadContext",
".",
"get",
"(",
")",
";",
"if",
"(",
"isValidContext",
"(",
"ctx",
")",
")",
"{",
"ctx",
".",
"... | Annotate a long value at the root Tracy frame | [
"Annotate",
"a",
"long",
"value",
"at",
"the",
"root",
"Tracy",
"frame"
] | 822d3aa335c1801df25ae6e67c22466368de3747 | https://github.com/joaovicente/Tracy/blob/822d3aa335c1801df25ae6e67c22466368de3747/src/main/java/com/apm4all/tracy/Tracy.java#L195-L200 | train |
joaovicente/Tracy | src/main/java/com/apm4all/tracy/Tracy.java | Tracy.annotateRoot | public static void annotateRoot(String booleanName, boolean booleanValue) {
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx)) {
ctx.annotateRoot(booleanName, booleanValue);
}
} | java | public static void annotateRoot(String booleanName, boolean booleanValue) {
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx)) {
ctx.annotateRoot(booleanName, booleanValue);
}
} | [
"public",
"static",
"void",
"annotateRoot",
"(",
"String",
"booleanName",
",",
"boolean",
"booleanValue",
")",
"{",
"TracyThreadContext",
"ctx",
"=",
"threadContext",
".",
"get",
"(",
")",
";",
"if",
"(",
"isValidContext",
"(",
"ctx",
")",
")",
"{",
"ctx",
... | Annotate a boolean value at the root Tracy frame | [
"Annotate",
"a",
"boolean",
"value",
"at",
"the",
"root",
"Tracy",
"frame"
] | 822d3aa335c1801df25ae6e67c22466368de3747 | https://github.com/joaovicente/Tracy/blob/822d3aa335c1801df25ae6e67c22466368de3747/src/main/java/com/apm4all/tracy/Tracy.java#L226-L231 | train |
joaovicente/Tracy | src/main/java/com/apm4all/tracy/Tracy.java | Tracy.getEvents | public static List<TracyEvent> getEvents() {
TracyThreadContext ctx = threadContext.get();
List<TracyEvent> events = EMPTY_TRACY_EVENT_LIST;
if (isValidContext(ctx)) {
events = ctx.getPoppedList();
}
return events;
} | java | public static List<TracyEvent> getEvents() {
TracyThreadContext ctx = threadContext.get();
List<TracyEvent> events = EMPTY_TRACY_EVENT_LIST;
if (isValidContext(ctx)) {
events = ctx.getPoppedList();
}
return events;
} | [
"public",
"static",
"List",
"<",
"TracyEvent",
">",
"getEvents",
"(",
")",
"{",
"TracyThreadContext",
"ctx",
"=",
"threadContext",
".",
"get",
"(",
")",
";",
"List",
"<",
"TracyEvent",
">",
"events",
"=",
"EMPTY_TRACY_EVENT_LIST",
";",
"if",
"(",
"isValidCon... | Once all work has been done, and TracyEvents are ready to be collected you can collect them using this method
@return list of TracyEvents | [
"Once",
"all",
"work",
"has",
"been",
"done",
"and",
"TracyEvents",
"are",
"ready",
"to",
"be",
"collected",
"you",
"can",
"collect",
"them",
"using",
"this",
"method"
] | 822d3aa335c1801df25ae6e67c22466368de3747 | https://github.com/joaovicente/Tracy/blob/822d3aa335c1801df25ae6e67c22466368de3747/src/main/java/com/apm4all/tracy/Tracy.java#L316-L323 | train |
joaovicente/Tracy | src/main/java/com/apm4all/tracy/Tracy.java | Tracy.getEventsAsJson | public static List<String> getEventsAsJson() {
List<String> list = Tracy.EMPTY_STRING_LIST;
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx)) {
list = new ArrayList<String>(20);
for (TracyEvent event : ctx.getPoppedList()) {
list.add(event.toJsonString());
}
}
return list;
} | java | public static List<String> getEventsAsJson() {
List<String> list = Tracy.EMPTY_STRING_LIST;
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx)) {
list = new ArrayList<String>(20);
for (TracyEvent event : ctx.getPoppedList()) {
list.add(event.toJsonString());
}
}
return list;
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getEventsAsJson",
"(",
")",
"{",
"List",
"<",
"String",
">",
"list",
"=",
"Tracy",
".",
"EMPTY_STRING_LIST",
";",
"TracyThreadContext",
"ctx",
"=",
"threadContext",
".",
"get",
"(",
")",
";",
"if",
"(",
"i... | Gets List of Tracy events in JSON format
@return list of Tracy JSONified events | [
"Gets",
"List",
"of",
"Tracy",
"events",
"in",
"JSON",
"format"
] | 822d3aa335c1801df25ae6e67c22466368de3747 | https://github.com/joaovicente/Tracy/blob/822d3aa335c1801df25ae6e67c22466368de3747/src/main/java/com/apm4all/tracy/Tracy.java#L348-L358 | train |
joaovicente/Tracy | src/main/java/com/apm4all/tracy/Tracy.java | Tracy.getEventsAsJsonTracySegment | public static String getEventsAsJsonTracySegment() {
// Assuming max 8 frames per segment. Typical Tracy JSON frame is ~250
// ( 250 * 8 = 2000). Rounding up to 2048
final int TRACY_SEGMENT_CHAR_SIZE = 2048;
String jsonArrayString = null;
int frameCounter = 0;
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx) && ctx.getPoppedList().size()>0) {
StringBuilder sb = new StringBuilder(TRACY_SEGMENT_CHAR_SIZE);
sb.append("{\"tracySegment\":[");
for (TracyEvent event : ctx.getPoppedList()) {
if (frameCounter > 0) {
sb.append(",");
}
sb.append(event.toJsonString());
frameCounter++;
}
sb.append("]}");
jsonArrayString = sb.toString();
}
return jsonArrayString;
} | java | public static String getEventsAsJsonTracySegment() {
// Assuming max 8 frames per segment. Typical Tracy JSON frame is ~250
// ( 250 * 8 = 2000). Rounding up to 2048
final int TRACY_SEGMENT_CHAR_SIZE = 2048;
String jsonArrayString = null;
int frameCounter = 0;
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx) && ctx.getPoppedList().size()>0) {
StringBuilder sb = new StringBuilder(TRACY_SEGMENT_CHAR_SIZE);
sb.append("{\"tracySegment\":[");
for (TracyEvent event : ctx.getPoppedList()) {
if (frameCounter > 0) {
sb.append(",");
}
sb.append(event.toJsonString());
frameCounter++;
}
sb.append("]}");
jsonArrayString = sb.toString();
}
return jsonArrayString;
} | [
"public",
"static",
"String",
"getEventsAsJsonTracySegment",
"(",
")",
"{",
"// Assuming max 8 frames per segment. Typical Tracy JSON frame is ~250 ",
"// ( 250 * 8 = 2000). Rounding up to 2048",
"final",
"int",
"TRACY_SEGMENT_CHAR_SIZE",
"=",
"2048",
";",
"String",
"jsonArrayString"... | Collects JSON Tracy Events array packaged as a value of tracySegment
@return JSON object containing Tracy array string | [
"Collects",
"JSON",
"Tracy",
"Events",
"array",
"packaged",
"as",
"a",
"value",
"of",
"tracySegment"
] | 822d3aa335c1801df25ae6e67c22466368de3747 | https://github.com/joaovicente/Tracy/blob/822d3aa335c1801df25ae6e67c22466368de3747/src/main/java/com/apm4all/tracy/Tracy.java#L364-L385 | train |
joaovicente/Tracy | src/main/java/com/apm4all/tracy/Tracy.java | Tracy.mergeWorkerContext | public static void mergeWorkerContext(TracyThreadContext workerTracyThreadContext) {
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx)) {
ctx.mergeChildContext(workerTracyThreadContext);
}
} | java | public static void mergeWorkerContext(TracyThreadContext workerTracyThreadContext) {
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx)) {
ctx.mergeChildContext(workerTracyThreadContext);
}
} | [
"public",
"static",
"void",
"mergeWorkerContext",
"(",
"TracyThreadContext",
"workerTracyThreadContext",
")",
"{",
"TracyThreadContext",
"ctx",
"=",
"threadContext",
".",
"get",
"(",
")",
";",
"if",
"(",
"isValidContext",
"(",
"ctx",
")",
")",
"{",
"ctx",
".",
... | When called from the requester thread, will merge worker TracyThreadContext into the
requester TracyThreadContext
@return worker TracyThreadContext | [
"When",
"called",
"from",
"the",
"requester",
"thread",
"will",
"merge",
"worker",
"TracyThreadContext",
"into",
"the",
"requester",
"TracyThreadContext"
] | 822d3aa335c1801df25ae6e67c22466368de3747 | https://github.com/joaovicente/Tracy/blob/822d3aa335c1801df25ae6e67c22466368de3747/src/main/java/com/apm4all/tracy/Tracy.java#L478-L483 | train |
joaovicente/Tracy | src/main/java/com/apm4all/tracy/Tracy.java | Tracy.frameErrorWithoutPopping | public static void frameErrorWithoutPopping(String error) {
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx)) {
ctx.annotateFrameError(error);
}
} | java | public static void frameErrorWithoutPopping(String error) {
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx)) {
ctx.annotateFrameError(error);
}
} | [
"public",
"static",
"void",
"frameErrorWithoutPopping",
"(",
"String",
"error",
")",
"{",
"TracyThreadContext",
"ctx",
"=",
"threadContext",
".",
"get",
"(",
")",
";",
"if",
"(",
"isValidContext",
"(",
"ctx",
")",
")",
"{",
"ctx",
".",
"annotateFrameError",
... | In case where an error occurs but the user does not want to raise an exception
and the user takes responsibility of ensuring Tracy.after is guaranteed to
be called then frameErrorWithoutPoping can be called to simply create an "error"
annotation | [
"In",
"case",
"where",
"an",
"error",
"occurs",
"but",
"the",
"user",
"does",
"not",
"want",
"to",
"raise",
"an",
"exception",
"and",
"the",
"user",
"takes",
"responsibility",
"of",
"ensuring",
"Tracy",
".",
"after",
"is",
"guaranteed",
"to",
"be",
"called... | 822d3aa335c1801df25ae6e67c22466368de3747 | https://github.com/joaovicente/Tracy/blob/822d3aa335c1801df25ae6e67c22466368de3747/src/main/java/com/apm4all/tracy/Tracy.java#L541-L546 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Searches.java | Searches.search | public static <E> List<E> search(Iterator<E> iterator, Predicate<E> predicate) {
final Function<Iterator<E>, ArrayList<E>> consumer = new ConsumeIntoCollection<>(new ArrayListFactory<E>());
final FilteringIterator<E> filtered = new FilteringIterator<E>(iterator, predicate);
return consumer.apply(filtered);
} | java | public static <E> List<E> search(Iterator<E> iterator, Predicate<E> predicate) {
final Function<Iterator<E>, ArrayList<E>> consumer = new ConsumeIntoCollection<>(new ArrayListFactory<E>());
final FilteringIterator<E> filtered = new FilteringIterator<E>(iterator, predicate);
return consumer.apply(filtered);
} | [
"public",
"static",
"<",
"E",
">",
"List",
"<",
"E",
">",
"search",
"(",
"Iterator",
"<",
"E",
">",
"iterator",
",",
"Predicate",
"<",
"E",
">",
"predicate",
")",
"{",
"final",
"Function",
"<",
"Iterator",
"<",
"E",
">",
",",
"ArrayList",
"<",
"E",... | Searches the iterator, consuming it, yielding every value matching the
predicate.
@param <E> the element type
@param iterator the iterator to be searched
@param predicate the predicate to be applied to each element
@return a list containing matching elements | [
"Searches",
"the",
"iterator",
"consuming",
"it",
"yielding",
"every",
"value",
"matching",
"the",
"predicate",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Searches.java#L39-L43 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Searches.java | Searches.search | public static <C extends Collection<E>, E> C search(Iterator<E> iterator, C collection, Predicate<E> predicate) {
final Function<Iterator<E>, C> consumer = new ConsumeIntoCollection<>(new ConstantSupplier<C>(collection));
final FilteringIterator<E> filtered = new FilteringIterator<E>(iterator, predicate);
return consumer.apply(filtered);
} | java | public static <C extends Collection<E>, E> C search(Iterator<E> iterator, C collection, Predicate<E> predicate) {
final Function<Iterator<E>, C> consumer = new ConsumeIntoCollection<>(new ConstantSupplier<C>(collection));
final FilteringIterator<E> filtered = new FilteringIterator<E>(iterator, predicate);
return consumer.apply(filtered);
} | [
"public",
"static",
"<",
"C",
"extends",
"Collection",
"<",
"E",
">",
",",
"E",
">",
"C",
"search",
"(",
"Iterator",
"<",
"E",
">",
"iterator",
",",
"C",
"collection",
",",
"Predicate",
"<",
"E",
">",
"predicate",
")",
"{",
"final",
"Function",
"<",
... | Searches the iterator, consuming it, adding every value matching the
predicate to the passed collection.
@param <C> the collection type
@param <E> the element type
@param iterator the iterator to be searched
@param collection the collection to be filled with matching elements
@param predicate the predicate to be applied to each element
@return the passed collection, filled with matching elements | [
"Searches",
"the",
"iterator",
"consuming",
"it",
"adding",
"every",
"value",
"matching",
"the",
"predicate",
"to",
"the",
"passed",
"collection",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Searches.java#L56-L60 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Searches.java | Searches.search | public static <C extends Collection<E>, E> C search(Iterable<E> iterable, C collection, Predicate<E> predicate) {
dbc.precondition(iterable != null, "cannot search a null iterable");
final Function<Iterator<E>, C> consumer = new ConsumeIntoCollection<>(new ConstantSupplier<C>(collection));
final FilteringIterator<E> filtered = new FilteringIterator<E>(iterable.iterator(), predicate);
return consumer.apply(filtered);
} | java | public static <C extends Collection<E>, E> C search(Iterable<E> iterable, C collection, Predicate<E> predicate) {
dbc.precondition(iterable != null, "cannot search a null iterable");
final Function<Iterator<E>, C> consumer = new ConsumeIntoCollection<>(new ConstantSupplier<C>(collection));
final FilteringIterator<E> filtered = new FilteringIterator<E>(iterable.iterator(), predicate);
return consumer.apply(filtered);
} | [
"public",
"static",
"<",
"C",
"extends",
"Collection",
"<",
"E",
">",
",",
"E",
">",
"C",
"search",
"(",
"Iterable",
"<",
"E",
">",
"iterable",
",",
"C",
"collection",
",",
"Predicate",
"<",
"E",
">",
"predicate",
")",
"{",
"dbc",
".",
"precondition"... | Searches the iterable, adding every value matching the predicate to the
passed collection.
@param <C> the collection type
@param <E> the element type
@param iterable the iterable to be searched
@param collection the collection to be filled with matching elements
@param predicate the predicate to be applied to each element
@return the passed collection, filled with matching elements | [
"Searches",
"the",
"iterable",
"adding",
"every",
"value",
"matching",
"the",
"predicate",
"to",
"the",
"passed",
"collection",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Searches.java#L106-L111 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Searches.java | Searches.search | public static <C extends Collection<E>, E> C search(E[] array, Supplier<C> supplier, Predicate<E> predicate) {
final Function<Iterator<E>, C> consumer = new ConsumeIntoCollection<>(supplier);
final FilteringIterator<E> filtered = new FilteringIterator<E>(new ArrayIterator<E>(array), predicate);
return consumer.apply(filtered);
} | java | public static <C extends Collection<E>, E> C search(E[] array, Supplier<C> supplier, Predicate<E> predicate) {
final Function<Iterator<E>, C> consumer = new ConsumeIntoCollection<>(supplier);
final FilteringIterator<E> filtered = new FilteringIterator<E>(new ArrayIterator<E>(array), predicate);
return consumer.apply(filtered);
} | [
"public",
"static",
"<",
"C",
"extends",
"Collection",
"<",
"E",
">",
",",
"E",
">",
"C",
"search",
"(",
"E",
"[",
"]",
"array",
",",
"Supplier",
"<",
"C",
">",
"supplier",
",",
"Predicate",
"<",
"E",
">",
"predicate",
")",
"{",
"final",
"Function"... | Searches the array, adding every value matching the predicate to the
collection yielded by the passed supplier.
@param <C> the collection type
@param <E> the element type
@param array the array to be searched
@param supplier the supplier of the resulting collection
@param predicate the predicate to be applied to each element
@return the collection provided by the passed supplier, filled with
matching elements | [
"Searches",
"the",
"array",
"adding",
"every",
"value",
"matching",
"the",
"predicate",
"to",
"the",
"collection",
"yielded",
"by",
"the",
"passed",
"supplier",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Searches.java#L176-L180 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Searches.java | Searches.find | public static <E> List<E> find(Iterator<E> iterator, Predicate<E> predicate) {
final Function<Iterator<E>, ArrayList<E>> consumer = new ConsumeIntoCollection<>(new ArrayListFactory<E>());
final FilteringIterator<E> filtered = new FilteringIterator<E>(iterator, predicate);
final ArrayList<E> found = consumer.apply(filtered);
dbc.precondition(!found.isEmpty(), "no element matched");
return found;
} | java | public static <E> List<E> find(Iterator<E> iterator, Predicate<E> predicate) {
final Function<Iterator<E>, ArrayList<E>> consumer = new ConsumeIntoCollection<>(new ArrayListFactory<E>());
final FilteringIterator<E> filtered = new FilteringIterator<E>(iterator, predicate);
final ArrayList<E> found = consumer.apply(filtered);
dbc.precondition(!found.isEmpty(), "no element matched");
return found;
} | [
"public",
"static",
"<",
"E",
">",
"List",
"<",
"E",
">",
"find",
"(",
"Iterator",
"<",
"E",
">",
"iterator",
",",
"Predicate",
"<",
"E",
">",
"predicate",
")",
"{",
"final",
"Function",
"<",
"Iterator",
"<",
"E",
">",
",",
"ArrayList",
"<",
"E",
... | Searches the iterator, consuming it, yielding every value matching the
predicate. An IllegalStateException is thrown if no element matches.
@param <E> the element type
@param iterator the iterator to be searched
@param predicate the predicate to be applied to each element
@throws IllegalArgumentException if no element matches
@return a list containing matching elements | [
"Searches",
"the",
"iterator",
"consuming",
"it",
"yielding",
"every",
"value",
"matching",
"the",
"predicate",
".",
"An",
"IllegalStateException",
"is",
"thrown",
"if",
"no",
"element",
"matches",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Searches.java#L192-L198 | train |
DaGeRe/KoPeMe | kopeme-analysis/src/main/java/de/dagere/kopeme/instrumentation/KiekerMeasureUtil.java | KiekerMeasureUtil.measureBefore | public void measureBefore() {
if (!CTRLINST.isMonitoringEnabled()) {
return;
}
hostname = VMNAME;
sessionId = SESSIONREGISTRY.recallThreadLocalSessionId();
traceId = CFREGISTRY.recallThreadLocalTraceId();
// entry point
if (traceId == -1) {
entrypoint = true;
traceId = CFREGISTRY.getAndStoreUniqueThreadLocalTraceId();
CFREGISTRY.storeThreadLocalEOI(0);
CFREGISTRY.storeThreadLocalESS(1); // next operation is ess + 1
eoi = 0;
ess = 0;
} else {
entrypoint = false;
eoi = CFREGISTRY.incrementAndRecallThreadLocalEOI(); // ess > 1
ess = CFREGISTRY.recallAndIncrementThreadLocalESS(); // ess >= 0
if ((eoi == -1) || (ess == -1)) {
LOG.error("eoi and/or ess have invalid values:" + " eoi == "
+ eoi + " ess == " + ess);
CTRLINST.terminateMonitoring();
}
}
tin = TIME.getTime();
} | java | public void measureBefore() {
if (!CTRLINST.isMonitoringEnabled()) {
return;
}
hostname = VMNAME;
sessionId = SESSIONREGISTRY.recallThreadLocalSessionId();
traceId = CFREGISTRY.recallThreadLocalTraceId();
// entry point
if (traceId == -1) {
entrypoint = true;
traceId = CFREGISTRY.getAndStoreUniqueThreadLocalTraceId();
CFREGISTRY.storeThreadLocalEOI(0);
CFREGISTRY.storeThreadLocalESS(1); // next operation is ess + 1
eoi = 0;
ess = 0;
} else {
entrypoint = false;
eoi = CFREGISTRY.incrementAndRecallThreadLocalEOI(); // ess > 1
ess = CFREGISTRY.recallAndIncrementThreadLocalESS(); // ess >= 0
if ((eoi == -1) || (ess == -1)) {
LOG.error("eoi and/or ess have invalid values:" + " eoi == "
+ eoi + " ess == " + ess);
CTRLINST.terminateMonitoring();
}
}
tin = TIME.getTime();
} | [
"public",
"void",
"measureBefore",
"(",
")",
"{",
"if",
"(",
"!",
"CTRLINST",
".",
"isMonitoringEnabled",
"(",
")",
")",
"{",
"return",
";",
"}",
"hostname",
"=",
"VMNAME",
";",
"sessionId",
"=",
"SESSIONREGISTRY",
".",
"recallThreadLocalSessionId",
"(",
")"... | Will be called to register the time when the method has started. | [
"Will",
"be",
"called",
"to",
"register",
"the",
"time",
"when",
"the",
"method",
"has",
"started",
"."
] | a4939113cba73cb20a2c7d6dc8d34d0139a3e340 | https://github.com/DaGeRe/KoPeMe/blob/a4939113cba73cb20a2c7d6dc8d34d0139a3e340/kopeme-analysis/src/main/java/de/dagere/kopeme/instrumentation/KiekerMeasureUtil.java#L72-L98 | train |
hdbeukel/james-extensions | src/main/java/org/jamesframework/ext/permutation/neigh/moves/ReverseSubsequenceMove.java | ReverseSubsequenceMove.apply | @Override
public void apply(PermutationSolution solution) {
int start = from;
int stop = to;
int n = solution.size();
// reverse subsequence by performing a series of swaps
// (works cyclically when start > stop)
int reversedLength;
if(start < stop){
reversedLength = stop-start+1;
} else {
reversedLength = n - (start-stop-1);
}
int numSwaps = reversedLength/2;
for(int k=0; k<numSwaps; k++){
solution.swap(start, stop);
start = (start+1) % n;
stop = (stop-1+n) % n;
}
} | java | @Override
public void apply(PermutationSolution solution) {
int start = from;
int stop = to;
int n = solution.size();
// reverse subsequence by performing a series of swaps
// (works cyclically when start > stop)
int reversedLength;
if(start < stop){
reversedLength = stop-start+1;
} else {
reversedLength = n - (start-stop-1);
}
int numSwaps = reversedLength/2;
for(int k=0; k<numSwaps; k++){
solution.swap(start, stop);
start = (start+1) % n;
stop = (stop-1+n) % n;
}
} | [
"@",
"Override",
"public",
"void",
"apply",
"(",
"PermutationSolution",
"solution",
")",
"{",
"int",
"start",
"=",
"from",
";",
"int",
"stop",
"=",
"to",
";",
"int",
"n",
"=",
"solution",
".",
"size",
"(",
")",
";",
"// reverse subsequence by performing a se... | Reverse the subsequence by performing a series of swaps in the given permutation solution.
@param solution permutation solution to which the move is to be applied | [
"Reverse",
"the",
"subsequence",
"by",
"performing",
"a",
"series",
"of",
"swaps",
"in",
"the",
"given",
"permutation",
"solution",
"."
] | 37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2 | https://github.com/hdbeukel/james-extensions/blob/37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2/src/main/java/org/jamesframework/ext/permutation/neigh/moves/ReverseSubsequenceMove.java#L75-L94 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/pruefung/AccessValidator.java | AccessValidator.access | public static <T> T access(T[] array, int n) {
int max = array.length - 1;
if ((n < 0) || (n > max)) {
throw new InvalidValueException(n, "n", Range.between(0, max));
}
return array[n];
} | java | public static <T> T access(T[] array, int n) {
int max = array.length - 1;
if ((n < 0) || (n > max)) {
throw new InvalidValueException(n, "n", Range.between(0, max));
}
return array[n];
} | [
"public",
"static",
"<",
"T",
">",
"T",
"access",
"(",
"T",
"[",
"]",
"array",
",",
"int",
"n",
")",
"{",
"int",
"max",
"=",
"array",
".",
"length",
"-",
"1",
";",
"if",
"(",
"(",
"n",
"<",
"0",
")",
"||",
"(",
"n",
">",
"max",
")",
")",
... | Liefert das n-te Element des uebergebenen Arrays zurueck, falls ein
korrekter Index uebergaben wird
@param <T> Typ-Parameter
@param array Array, auf das zugegriffen wird
@param n Array-Index, beginnend bei 0
@return n -te Element des Arrays | [
"Liefert",
"das",
"n",
"-",
"te",
"Element",
"des",
"uebergebenen",
"Arrays",
"zurueck",
"falls",
"ein",
"korrekter",
"Index",
"uebergaben",
"wird"
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/pruefung/AccessValidator.java#L46-L52 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/contracts/dbc.java | dbc.precondition | public static void precondition(boolean assertion, String format, Object... params) {
if (!assertion) {
throw new IllegalArgumentException(String.format(format, params));
}
} | java | public static void precondition(boolean assertion, String format, Object... params) {
if (!assertion) {
throw new IllegalArgumentException(String.format(format, params));
}
} | [
"public",
"static",
"void",
"precondition",
"(",
"boolean",
"assertion",
",",
"String",
"format",
",",
"Object",
"...",
"params",
")",
"{",
"if",
"(",
"!",
"assertion",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
... | Enforces a state precondition, throwing an IllegalArgumentException if
the assertion fails.
@param assertion the assertion to be enforced
@param format the exception message format string
@param params the exception message parameters
@throws IllegalArgumentException if the assertion fails | [
"Enforces",
"a",
"state",
"precondition",
"throwing",
"an",
"IllegalArgumentException",
"if",
"the",
"assertion",
"fails",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/contracts/dbc.java#L19-L23 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/contracts/dbc.java | dbc.state | public static void state(boolean assertion, String format, Object... params) {
if (!assertion) {
throw new IllegalStateException(String.format(format, params));
}
} | java | public static void state(boolean assertion, String format, Object... params) {
if (!assertion) {
throw new IllegalStateException(String.format(format, params));
}
} | [
"public",
"static",
"void",
"state",
"(",
"boolean",
"assertion",
",",
"String",
"format",
",",
"Object",
"...",
"params",
")",
"{",
"if",
"(",
"!",
"assertion",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"String",
".",
"format",
"(",
"format"... | Enforces a state precondition, throwing an IllegalStateException if the
assertion fails.
@param assertion the assertion to be enforced
@param format the exception message format string
@param params the exception message parameters
@throws IllegalStateException if the assertion fails | [
"Enforces",
"a",
"state",
"precondition",
"throwing",
"an",
"IllegalStateException",
"if",
"the",
"assertion",
"fails",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/contracts/dbc.java#L34-L38 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/bank/internal/GeldbetragSingletonSpi.java | GeldbetragSingletonSpi.getAmountFactory | @SuppressWarnings("unchecked")
@Override
public <T extends MonetaryAmount> MonetaryAmountFactory<T> getAmountFactory(Class<T> amountType) {
if (Geldbetrag.class.equals(amountType)) {
return (MonetaryAmountFactory<T>) new GeldbetragFactory();
}
MonetaryAmountFactoryProviderSpi<T> f = MonetaryAmountFactoryProviderSpi.class.cast(factories.get(amountType));
if (Objects.nonNull(f)) {
return f.createMonetaryAmountFactory();
}
throw new MonetaryException("no MonetaryAmountFactory found for " + amountType);
} | java | @SuppressWarnings("unchecked")
@Override
public <T extends MonetaryAmount> MonetaryAmountFactory<T> getAmountFactory(Class<T> amountType) {
if (Geldbetrag.class.equals(amountType)) {
return (MonetaryAmountFactory<T>) new GeldbetragFactory();
}
MonetaryAmountFactoryProviderSpi<T> f = MonetaryAmountFactoryProviderSpi.class.cast(factories.get(amountType));
if (Objects.nonNull(f)) {
return f.createMonetaryAmountFactory();
}
throw new MonetaryException("no MonetaryAmountFactory found for " + amountType);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Override",
"public",
"<",
"T",
"extends",
"MonetaryAmount",
">",
"MonetaryAmountFactory",
"<",
"T",
">",
"getAmountFactory",
"(",
"Class",
"<",
"T",
">",
"amountType",
")",
"{",
"if",
"(",
"Geldbetrag",... | save cast, since members are managed by this instance | [
"save",
"cast",
"since",
"members",
"are",
"managed",
"by",
"this",
"instance"
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/bank/internal/GeldbetragSingletonSpi.java#L59-L70 | train |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/style/DefaultStylerFactory.java | DefaultStylerFactory.debugStylers | private DebugStyler debugStylers(String... names) throws VectorPrintException {
if (settings.getBooleanProperty(false, DEBUG)) {
DebugStyler dst = new DebugStyler();
StylerFactoryHelper.initStylingObject(dst, writer, document, null, layerManager, settings);
try {
ParamAnnotationProcessorImpl.PAP.initParameters(dst);
} catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException ex) {
throw new VectorPrintException(ex);
}
for (String n : names) {
dst.getStyleSetup().add(n);
styleSetup.put(n, SettingsBindingService.getInstance().getFactory().getBindingHelper().serializeValue(settings.getStringProperties(null, n)));
}
return dst;
}
return null;
} | java | private DebugStyler debugStylers(String... names) throws VectorPrintException {
if (settings.getBooleanProperty(false, DEBUG)) {
DebugStyler dst = new DebugStyler();
StylerFactoryHelper.initStylingObject(dst, writer, document, null, layerManager, settings);
try {
ParamAnnotationProcessorImpl.PAP.initParameters(dst);
} catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException ex) {
throw new VectorPrintException(ex);
}
for (String n : names) {
dst.getStyleSetup().add(n);
styleSetup.put(n, SettingsBindingService.getInstance().getFactory().getBindingHelper().serializeValue(settings.getStringProperties(null, n)));
}
return dst;
}
return null;
} | [
"private",
"DebugStyler",
"debugStylers",
"(",
"String",
"...",
"names",
")",
"throws",
"VectorPrintException",
"{",
"if",
"(",
"settings",
".",
"getBooleanProperty",
"(",
"false",
",",
"DEBUG",
")",
")",
"{",
"DebugStyler",
"dst",
"=",
"new",
"DebugStyler",
"... | return a debug styler that will be appended to the stylers for providing debugging info in reports
@param names
@return | [
"return",
"a",
"debug",
"styler",
"that",
"will",
"be",
"appended",
"to",
"the",
"stylers",
"for",
"providing",
"debugging",
"info",
"in",
"reports"
] | b5fb7a89e16d9b35f557f3bf620594f821fa1552 | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/style/DefaultStylerFactory.java#L217-L235 | train |
opentable/otj-core | src/main/java/com/opentable/util/Optionals.java | Optionals.mapAdapter | public static <K,V> MapAdapter<K,V> mapAdapter(final Map<K,V> map) {
return key -> Optional.ofNullable(map.get(key));
} | java | public static <K,V> MapAdapter<K,V> mapAdapter(final Map<K,V> map) {
return key -> Optional.ofNullable(map.get(key));
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"MapAdapter",
"<",
"K",
",",
"V",
">",
"mapAdapter",
"(",
"final",
"Map",
"<",
"K",
",",
"V",
">",
"map",
")",
"{",
"return",
"key",
"->",
"Optional",
".",
"ofNullable",
"(",
"map",
".",
"get",
"(",
... | Produces a MapAdapter for the given Map.
@param <K> type of map keys
@param <V> type of map values | [
"Produces",
"a",
"MapAdapter",
"for",
"the",
"given",
"Map",
"."
] | b6d36be17c9d9e19458c14924280cc1a0d4e5785 | https://github.com/opentable/otj-core/blob/b6d36be17c9d9e19458c14924280cc1a0d4e5785/src/main/java/com/opentable/util/Optionals.java#L97-L99 | train |
opentable/otj-core | src/main/java/com/opentable/util/Optionals.java | Optionals.firstInList | public static <T> Optional<T> firstInList(List<T> list) {
return list.isEmpty() ? Optional.empty() : Optional.ofNullable(list.get(0));
} | java | public static <T> Optional<T> firstInList(List<T> list) {
return list.isEmpty() ? Optional.empty() : Optional.ofNullable(list.get(0));
} | [
"public",
"static",
"<",
"T",
">",
"Optional",
"<",
"T",
">",
"firstInList",
"(",
"List",
"<",
"T",
">",
"list",
")",
"{",
"return",
"list",
".",
"isEmpty",
"(",
")",
"?",
"Optional",
".",
"empty",
"(",
")",
":",
"Optional",
".",
"ofNullable",
"(",... | Adapter to create an Optional out of the first element of a List. If the list is empty, we get
an empty optional. Also, if the first element is null, return an empty optional.
@param <T> the type of objects in the list
@param list the list to look at
@return the possible first element in list | [
"Adapter",
"to",
"create",
"an",
"Optional",
"out",
"of",
"the",
"first",
"element",
"of",
"a",
"List",
".",
"If",
"the",
"list",
"is",
"empty",
"we",
"get",
"an",
"empty",
"optional",
".",
"Also",
"if",
"the",
"first",
"element",
"is",
"null",
"return... | b6d36be17c9d9e19458c14924280cc1a0d4e5785 | https://github.com/opentable/otj-core/blob/b6d36be17c9d9e19458c14924280cc1a0d4e5785/src/main/java/com/opentable/util/Optionals.java#L123-L125 | train |
opentable/otj-core | src/main/java/com/opentable/util/Optionals.java | Optionals.getOpt | public static <K,V> Optional<V> getOpt(Map<K,V> map, K key) {
return Optional.ofNullable(map.get(key));
} | java | public static <K,V> Optional<V> getOpt(Map<K,V> map, K key) {
return Optional.ofNullable(map.get(key));
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Optional",
"<",
"V",
">",
"getOpt",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
",",
"K",
"key",
")",
"{",
"return",
"Optional",
".",
"ofNullable",
"(",
"map",
".",
"get",
"(",
"key",
")",
")",
";... | Get an item from a map, wrapping it in an Optional
@param map the map on which to perform the lookup
@param key the key to look up
@param <K> the type of key
@param <V> the type of values in the map
@return Optional-wrapped V | [
"Get",
"an",
"item",
"from",
"a",
"map",
"wrapping",
"it",
"in",
"an",
"Optional"
] | b6d36be17c9d9e19458c14924280cc1a0d4e5785 | https://github.com/opentable/otj-core/blob/b6d36be17c9d9e19458c14924280cc1a0d4e5785/src/main/java/com/opentable/util/Optionals.java#L135-L137 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/bank/GeldbetragFactory.java | GeldbetragFactory.setNumber | @Override
public GeldbetragFactory setNumber(Number number) {
this.number = number;
this.context = getMonetaryContextOf(number);
return this;
} | java | @Override
public GeldbetragFactory setNumber(Number number) {
this.number = number;
this.context = getMonetaryContextOf(number);
return this;
} | [
"@",
"Override",
"public",
"GeldbetragFactory",
"setNumber",
"(",
"Number",
"number",
")",
"{",
"this",
".",
"number",
"=",
"number",
";",
"this",
".",
"context",
"=",
"getMonetaryContextOf",
"(",
"number",
")",
";",
"return",
"this",
";",
"}"
] | Setzt die Nummer fuer den Geldbetrag.
@param number Betrag, darf nicht {@code null} sein.
@return die Factory selber | [
"Setzt",
"die",
"Nummer",
"fuer",
"den",
"Geldbetrag",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/bank/GeldbetragFactory.java#L94-L99 | train |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/EventHelper.java | EventHelper.onOpenDocument | @Override
public final void onOpenDocument(PdfWriter writer, Document document) {
super.onOpenDocument(writer, document);
template = writer.getDirectContent().createTemplate(document.getPageSize().getWidth(), document.getPageSize().getHeight());
if (!getSettings().containsKey(PAGEFOOTERSTYLEKEY)) {
getSettings().put(PAGEFOOTERSTYLEKEY, PAGEFOOTERSTYLE);
}
if (!getSettings().containsKey(PAGEFOOTERTABLEKEY)) {
float tot = ItextHelper.ptsToMm(document.getPageSize().getWidth() - document.leftMargin() - document.rightMargin());
getSettings().put(PAGEFOOTERTABLEKEY, new StringBuilder("Table(columns=3,widths=")
.append(Math.round(tot * getSettings().getFloatProperty(0.85f, "footerleftwidthpercentage"))).append('|')
.append(Math.round(tot * getSettings().getFloatProperty(0.14f, "footermiddlewidthpercentage"))).append('|')
.append(Math.round(tot * getSettings().getFloatProperty(0.01f, "footerrightwidthpercentage"))).append(')').toString()
);
}
} | java | @Override
public final void onOpenDocument(PdfWriter writer, Document document) {
super.onOpenDocument(writer, document);
template = writer.getDirectContent().createTemplate(document.getPageSize().getWidth(), document.getPageSize().getHeight());
if (!getSettings().containsKey(PAGEFOOTERSTYLEKEY)) {
getSettings().put(PAGEFOOTERSTYLEKEY, PAGEFOOTERSTYLE);
}
if (!getSettings().containsKey(PAGEFOOTERTABLEKEY)) {
float tot = ItextHelper.ptsToMm(document.getPageSize().getWidth() - document.leftMargin() - document.rightMargin());
getSettings().put(PAGEFOOTERTABLEKEY, new StringBuilder("Table(columns=3,widths=")
.append(Math.round(tot * getSettings().getFloatProperty(0.85f, "footerleftwidthpercentage"))).append('|')
.append(Math.round(tot * getSettings().getFloatProperty(0.14f, "footermiddlewidthpercentage"))).append('|')
.append(Math.round(tot * getSettings().getFloatProperty(0.01f, "footerrightwidthpercentage"))).append(')').toString()
);
}
} | [
"@",
"Override",
"public",
"final",
"void",
"onOpenDocument",
"(",
"PdfWriter",
"writer",
",",
"Document",
"document",
")",
"{",
"super",
".",
"onOpenDocument",
"(",
"writer",
",",
"document",
")",
";",
"template",
"=",
"writer",
".",
"getDirectContent",
"(",
... | prepares template for printing header and footer
@param writer
@param document | [
"prepares",
"template",
"for",
"printing",
"header",
"and",
"footer"
] | b5fb7a89e16d9b35f557f3bf620594f821fa1552 | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/EventHelper.java#L130-L145 | train |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/EventHelper.java | EventHelper.printFailureHeader | protected void printFailureHeader(PdfTemplate template, float x, float y) {
Font f = DebugHelper.debugFontLink(template, getSettings());
Chunk c = new Chunk(getSettings().getProperty("failures in report, see end of report", "failureheader"), f);
ColumnText.showTextAligned(template, Element.ALIGN_LEFT, new Phrase(c), x, y, 0);
} | java | protected void printFailureHeader(PdfTemplate template, float x, float y) {
Font f = DebugHelper.debugFontLink(template, getSettings());
Chunk c = new Chunk(getSettings().getProperty("failures in report, see end of report", "failureheader"), f);
ColumnText.showTextAligned(template, Element.ALIGN_LEFT, new Phrase(c), x, y, 0);
} | [
"protected",
"void",
"printFailureHeader",
"(",
"PdfTemplate",
"template",
",",
"float",
"x",
",",
"float",
"y",
")",
"{",
"Font",
"f",
"=",
"DebugHelper",
".",
"debugFontLink",
"(",
"template",
",",
"getSettings",
"(",
")",
")",
";",
"Chunk",
"c",
"=",
... | when failure information is appended to the report, a header on each page will be printed refering to this
information.
@param template
@param x
@param y | [
"when",
"failure",
"information",
"is",
"appended",
"to",
"the",
"report",
"a",
"header",
"on",
"each",
"page",
"will",
"be",
"printed",
"refering",
"to",
"this",
"information",
"."
] | b5fb7a89e16d9b35f557f3bf620594f821fa1552 | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/EventHelper.java#L242-L246 | train |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/EventHelper.java | EventHelper.renderFooter | protected void renderFooter(PdfWriter writer, Document document) throws DocumentException, VectorPrintException, InstantiationException, IllegalAccessException {
if (!debugHereAfter && !failuresHereAfter) {
PdfPTable footerTable = elementProducer.createElement(null, PdfPTable.class, getStylers(PAGEFOOTERTABLEKEY));
footerTable.addCell(createFooterCell(ValueHelper.createDate(new Date())));
String pageText = writer.getPageNumber() + getSettings().getProperty(" of ", UPTO);
PdfPCell c = createFooterCell(pageText);
c.setHorizontalAlignment(Element.ALIGN_RIGHT);
footerTable.addCell(c);
footerTable.addCell(createFooterCell(new Chunk()));
footerTable.writeSelectedRows(0, -1, document.getPageSize().getLeft() + document.leftMargin(),
document.getPageSize().getBottom(document.bottomMargin()), writer.getDirectContentUnder());
footerBottom = document.bottom() - footerTable.getTotalHeight();
}
} | java | protected void renderFooter(PdfWriter writer, Document document) throws DocumentException, VectorPrintException, InstantiationException, IllegalAccessException {
if (!debugHereAfter && !failuresHereAfter) {
PdfPTable footerTable = elementProducer.createElement(null, PdfPTable.class, getStylers(PAGEFOOTERTABLEKEY));
footerTable.addCell(createFooterCell(ValueHelper.createDate(new Date())));
String pageText = writer.getPageNumber() + getSettings().getProperty(" of ", UPTO);
PdfPCell c = createFooterCell(pageText);
c.setHorizontalAlignment(Element.ALIGN_RIGHT);
footerTable.addCell(c);
footerTable.addCell(createFooterCell(new Chunk()));
footerTable.writeSelectedRows(0, -1, document.getPageSize().getLeft() + document.leftMargin(),
document.getPageSize().getBottom(document.bottomMargin()), writer.getDirectContentUnder());
footerBottom = document.bottom() - footerTable.getTotalHeight();
}
} | [
"protected",
"void",
"renderFooter",
"(",
"PdfWriter",
"writer",
",",
"Document",
"document",
")",
"throws",
"DocumentException",
",",
"VectorPrintException",
",",
"InstantiationException",
",",
"IllegalAccessException",
"{",
"if",
"(",
"!",
"debugHereAfter",
"&&",
"!... | prints a footer table with a line at the top, a date and page numbering, second cell will be right aligned
@see #PAGEFOOTERTABLEKEY
@see #PAGEFOOTERSTYLEKEY
@param writer
@param document
@throws DocumentException
@throws VectorPrintException | [
"prints",
"a",
"footer",
"table",
"with",
"a",
"line",
"at",
"the",
"top",
"a",
"date",
"and",
"page",
"numbering",
"second",
"cell",
"will",
"be",
"right",
"aligned"
] | b5fb7a89e16d9b35f557f3bf620594f821fa1552 | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/EventHelper.java#L354-L371 | train |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/EventHelper.java | EventHelper.getTemplateImage | protected Image getTemplateImage(PdfTemplate template) throws BadElementException {
if (templateImage == null) {
templateImage = Image.getInstance(template);
templateImage.setAbsolutePosition(0, 0);
}
return templateImage;
} | java | protected Image getTemplateImage(PdfTemplate template) throws BadElementException {
if (templateImage == null) {
templateImage = Image.getInstance(template);
templateImage.setAbsolutePosition(0, 0);
}
return templateImage;
} | [
"protected",
"Image",
"getTemplateImage",
"(",
"PdfTemplate",
"template",
")",
"throws",
"BadElementException",
"{",
"if",
"(",
"templateImage",
"==",
"null",
")",
"{",
"templateImage",
"=",
"Image",
".",
"getInstance",
"(",
"template",
")",
";",
"templateImage",
... | this image will be used for painting the total number of pages and for a failure header when failures are printed
inside the report.
@see #printFailureHeader(com.itextpdf.text.pdf.PdfTemplate, float, float)
@see #printTotalPages(com.itextpdf.text.pdf.PdfTemplate, float, float)
@param template
@return
@throws BadElementException | [
"this",
"image",
"will",
"be",
"used",
"for",
"painting",
"the",
"total",
"number",
"of",
"pages",
"and",
"for",
"a",
"failure",
"header",
"when",
"failures",
"are",
"printed",
"inside",
"the",
"report",
"."
] | b5fb7a89e16d9b35f557f3bf620594f821fa1552 | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/EventHelper.java#L385-L392 | train |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/style/StylerFactoryHelper.java | StylerFactoryHelper.findForCssName | public static Collection<BaseStyler> findForCssName(String cssName, boolean required) throws ClassNotFoundException, IOException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
Collection<BaseStyler> stylers = new ArrayList<>(1);
for (Class<?> c : ClassHelper.fromPackage(Font.class.getPackage())) {
if (!Modifier.isAbstract(c.getModifiers())&&BaseStyler.class.isAssignableFrom(c)) {
BaseStyler bs = (BaseStyler) c.newInstance();
if (bs.findForCssProperty(cssName) != null && !bs.findForCssProperty(cssName).isEmpty()) {
stylers.add(bs);
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine(String.format("found %s supporting css property %s", cssName, bs.getClass().getName()));
}
}
}
}
if (stylers.isEmpty()) {
if (required) {
throw new IllegalArgumentException(String.format("no styler supports css property %s", cssName));
} else {
LOGGER.warning(String.format("no styler supports css property %s", cssName));
}
}
return stylers;
} | java | public static Collection<BaseStyler> findForCssName(String cssName, boolean required) throws ClassNotFoundException, IOException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
Collection<BaseStyler> stylers = new ArrayList<>(1);
for (Class<?> c : ClassHelper.fromPackage(Font.class.getPackage())) {
if (!Modifier.isAbstract(c.getModifiers())&&BaseStyler.class.isAssignableFrom(c)) {
BaseStyler bs = (BaseStyler) c.newInstance();
if (bs.findForCssProperty(cssName) != null && !bs.findForCssProperty(cssName).isEmpty()) {
stylers.add(bs);
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine(String.format("found %s supporting css property %s", cssName, bs.getClass().getName()));
}
}
}
}
if (stylers.isEmpty()) {
if (required) {
throw new IllegalArgumentException(String.format("no styler supports css property %s", cssName));
} else {
LOGGER.warning(String.format("no styler supports css property %s", cssName));
}
}
return stylers;
} | [
"public",
"static",
"Collection",
"<",
"BaseStyler",
">",
"findForCssName",
"(",
"String",
"cssName",
",",
"boolean",
"required",
")",
"throws",
"ClassNotFoundException",
",",
"IOException",
",",
"InstantiationException",
",",
"IllegalAccessException",
",",
"NoSuchMetho... | find BaseStylers that implements a css property.
@param cssName
@param required when true throw an illegalargumentexception when no styler is found for the css name
@see BaseStyler#findForCssProperty(java.lang.String)
@throws ClassNotFoundException
@throws IOException
@throws InstantiationException
@throws IllegalAccessException
@return the java.util.Collection<com.vectorprint.report.itext.style.BaseStyler> | [
"find",
"BaseStylers",
"that",
"implements",
"a",
"css",
"property",
"."
] | b5fb7a89e16d9b35f557f3bf620594f821fa1552 | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/style/StylerFactoryHelper.java#L109-L130 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/bank/Waehrung.java | Waehrung.of | public static Waehrung of(Currency currency) {
String key = currency.getCurrencyCode();
return CACHE.computeIfAbsent(key, t -> new Waehrung(currency));
} | java | public static Waehrung of(Currency currency) {
String key = currency.getCurrencyCode();
return CACHE.computeIfAbsent(key, t -> new Waehrung(currency));
} | [
"public",
"static",
"Waehrung",
"of",
"(",
"Currency",
"currency",
")",
"{",
"String",
"key",
"=",
"currency",
".",
"getCurrencyCode",
"(",
")",
";",
"return",
"CACHE",
".",
"computeIfAbsent",
"(",
"key",
",",
"t",
"->",
"new",
"Waehrung",
"(",
"currency",... | Gibt die entsprechende Currency als Waehrung zurueck. Da die Anzahl der
Waehrungen ueberschaubar ist, werden sie in einem dauerhaften Cache
vorgehalten.
@param currency Currency
@return Waehrung | [
"Gibt",
"die",
"entsprechende",
"Currency",
"als",
"Waehrung",
"zurueck",
".",
"Da",
"die",
"Anzahl",
"der",
"Waehrungen",
"ueberschaubar",
"ist",
"werden",
"sie",
"in",
"einem",
"dauerhaften",
"Cache",
"vorgehalten",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/bank/Waehrung.java#L83-L86 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/bank/Waehrung.java | Waehrung.of | public static Waehrung of(CurrencyUnit currencyUnit) {
if (currencyUnit instanceof Waehrung) {
return (Waehrung) currencyUnit;
} else {
return of(currencyUnit.getCurrencyCode());
}
} | java | public static Waehrung of(CurrencyUnit currencyUnit) {
if (currencyUnit instanceof Waehrung) {
return (Waehrung) currencyUnit;
} else {
return of(currencyUnit.getCurrencyCode());
}
} | [
"public",
"static",
"Waehrung",
"of",
"(",
"CurrencyUnit",
"currencyUnit",
")",
"{",
"if",
"(",
"currencyUnit",
"instanceof",
"Waehrung",
")",
"{",
"return",
"(",
"Waehrung",
")",
"currencyUnit",
";",
"}",
"else",
"{",
"return",
"of",
"(",
"currencyUnit",
".... | Gibt die entsprechende Currency als Waehrung zurueck.
@param currencyUnit CurrencyUnit
@return Waehrung | [
"Gibt",
"die",
"entsprechende",
"Currency",
"als",
"Waehrung",
"zurueck",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/bank/Waehrung.java#L94-L100 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/bank/Waehrung.java | Waehrung.validate | public static String validate(String code) {
try {
toCurrency(code);
} catch (IllegalArgumentException ex) {
throw new InvalidValueException(code, "currency");
}
return code;
} | java | public static String validate(String code) {
try {
toCurrency(code);
} catch (IllegalArgumentException ex) {
throw new InvalidValueException(code, "currency");
}
return code;
} | [
"public",
"static",
"String",
"validate",
"(",
"String",
"code",
")",
"{",
"try",
"{",
"toCurrency",
"(",
"code",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"ex",
")",
"{",
"throw",
"new",
"InvalidValueException",
"(",
"code",
",",
"\"currency\... | Validiert den uebergebenen Waehrungscode.
@param code Waehrungscode als String
@return Waehrungscode zur Weiterverarbeitung | [
"Validiert",
"den",
"uebergebenen",
"Waehrungscode",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/bank/Waehrung.java#L151-L158 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/bank/Waehrung.java | Waehrung.getSymbol | public static String getSymbol(CurrencyUnit cu) {
try {
return Waehrung.of(cu).getSymbol();
} catch (IllegalArgumentException ex) {
LOG.log(Level.WARNING, "Cannot get symbol for '" + cu + "':", ex);
return cu.getCurrencyCode();
}
} | java | public static String getSymbol(CurrencyUnit cu) {
try {
return Waehrung.of(cu).getSymbol();
} catch (IllegalArgumentException ex) {
LOG.log(Level.WARNING, "Cannot get symbol for '" + cu + "':", ex);
return cu.getCurrencyCode();
}
} | [
"public",
"static",
"String",
"getSymbol",
"(",
"CurrencyUnit",
"cu",
")",
"{",
"try",
"{",
"return",
"Waehrung",
".",
"of",
"(",
"cu",
")",
".",
"getSymbol",
"(",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"ex",
")",
"{",
"LOG",
".",
"lo... | Lieft das Waehrungssymbol der uebergebenen Waehrungseinheit.
@param cu Waehrungseinheit
@return z.B. das Euro-Zeichen | [
"Lieft",
"das",
"Waehrungssymbol",
"der",
"uebergebenen",
"Waehrungseinheit",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/bank/Waehrung.java#L219-L226 | train |
panossot/jam-metrics | ApplicationMetricsStandalone/ApplicationMetricsApi/src/main/java/org/jam/metrics/applicationmetricsapi/MetricsCacheApi.java | MetricsCacheApi.compareMetricsCacheValuesByKey | public static synchronized boolean compareMetricsCacheValuesByKey(String deployment, String key, ArrayList<Object> valuesToCompare) {
boolean isEqual = true;
ArrayList<Object> cacheValues;
cacheValues = getMetricsCache(deployment).get(key);
for (Object valueComp : valuesToCompare) {
for (Object value : cacheValues) {
if (value.toString().compareTo(valueComp.toString()) == 0) {
isEqual = true;
break;
}
isEqual = false;
}
}
return isEqual;
} | java | public static synchronized boolean compareMetricsCacheValuesByKey(String deployment, String key, ArrayList<Object> valuesToCompare) {
boolean isEqual = true;
ArrayList<Object> cacheValues;
cacheValues = getMetricsCache(deployment).get(key);
for (Object valueComp : valuesToCompare) {
for (Object value : cacheValues) {
if (value.toString().compareTo(valueComp.toString()) == 0) {
isEqual = true;
break;
}
isEqual = false;
}
}
return isEqual;
} | [
"public",
"static",
"synchronized",
"boolean",
"compareMetricsCacheValuesByKey",
"(",
"String",
"deployment",
",",
"String",
"key",
",",
"ArrayList",
"<",
"Object",
">",
"valuesToCompare",
")",
"{",
"boolean",
"isEqual",
"=",
"true",
";",
"ArrayList",
"<",
"Object... | Dummy comparison for test cases. | [
"Dummy",
"comparison",
"for",
"test",
"cases",
"."
] | 1818633304dca731d4beaf6c5d4f000e8a88d725 | https://github.com/panossot/jam-metrics/blob/1818633304dca731d4beaf6c5d4f000e8a88d725/ApplicationMetricsStandalone/ApplicationMetricsApi/src/main/java/org/jam/metrics/applicationmetricsapi/MetricsCacheApi.java#L135-L151 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Casts.java | Casts.widen | public static <T, R> R widen(T value) {
return new Vary<T, R>().apply(value);
} | java | public static <T, R> R widen(T value) {
return new Vary<T, R>().apply(value);
} | [
"public",
"static",
"<",
"T",
",",
"R",
">",
"R",
"widen",
"(",
"T",
"value",
")",
"{",
"return",
"new",
"Vary",
"<",
"T",
",",
"R",
">",
"(",
")",
".",
"apply",
"(",
"value",
")",
";",
"}"
] | Performs a downcast on a value.
@param <T> the source type
@param <R> the resulting type
@param value the value to be cast
@return the resulting value | [
"Performs",
"a",
"downcast",
"on",
"a",
"value",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Casts.java#L21-L23 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Casts.java | Casts.narrow | public static <T extends R, R> R narrow(T value) {
return new Vary<T, R>().apply(value);
} | java | public static <T extends R, R> R narrow(T value) {
return new Vary<T, R>().apply(value);
} | [
"public",
"static",
"<",
"T",
"extends",
"R",
",",
"R",
">",
"R",
"narrow",
"(",
"T",
"value",
")",
"{",
"return",
"new",
"Vary",
"<",
"T",
",",
"R",
">",
"(",
")",
".",
"apply",
"(",
"value",
")",
";",
"}"
] | Performs an upcast on a value.
@param <T> the source type
@param <R> the resulting type
@param value the value to be cast
@return the resulting value | [
"Performs",
"an",
"upcast",
"on",
"a",
"value",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Casts.java#L44-L46 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Casts.java | Casts.vary | public static <T, R> R vary(T value) {
return new Vary<T, R>().apply(value);
} | java | public static <T, R> R vary(T value) {
return new Vary<T, R>().apply(value);
} | [
"public",
"static",
"<",
"T",
",",
"R",
">",
"R",
"vary",
"(",
"T",
"value",
")",
"{",
"return",
"new",
"Vary",
"<",
"T",
",",
"R",
">",
"(",
")",
".",
"apply",
"(",
"value",
")",
";",
"}"
] | Performs a reinterpret cast on a value.
@param <R> the resulting type
@param <T> the source type
@param value the value to be cast
@return the resulting value | [
"Performs",
"a",
"reinterpret",
"cast",
"on",
"a",
"value",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Casts.java#L67-L69 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/post/PLZ.java | PLZ.validate | public static String validate(String code) {
String plz = normalize(code);
if (hasLandeskennung(plz)) {
validateNumberOf(plz);
} else {
plz = LengthValidator.validate(plz, 3, 10);
}
return plz;
} | java | public static String validate(String code) {
String plz = normalize(code);
if (hasLandeskennung(plz)) {
validateNumberOf(plz);
} else {
plz = LengthValidator.validate(plz, 3, 10);
}
return plz;
} | [
"public",
"static",
"String",
"validate",
"(",
"String",
"code",
")",
"{",
"String",
"plz",
"=",
"normalize",
"(",
"code",
")",
";",
"if",
"(",
"hasLandeskennung",
"(",
"plz",
")",
")",
"{",
"validateNumberOf",
"(",
"plz",
")",
";",
"}",
"else",
"{",
... | Eine Postleitahl muss zwischen 3 und 10 Ziffern lang sein. Eventuell
kann noch die Laenderkennung vorangestellt werden. Dies wird hier
ueberprueft.
@param code die PLZ
@return die validierte PLZ (zur Weiterverarbeitung) | [
"Eine",
"Postleitahl",
"muss",
"zwischen",
"3",
"und",
"10",
"Ziffern",
"lang",
"sein",
".",
"Eventuell",
"kann",
"noch",
"die",
"Laenderkennung",
"vorangestellt",
"werden",
".",
"Dies",
"wird",
"hier",
"ueberprueft",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/post/PLZ.java#L97-L105 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/post/PLZ.java | PLZ.getLand | public Locale getLand() {
String kennung = this.getLandeskennung();
switch (kennung) {
case "D": return new Locale("de", "DE");
case "A": return new Locale("de", "AT");
case "CH": return new Locale("de", "CH");
default: throw new UnsupportedOperationException("unbekannte Landeskennung '" + kennung + "'");
}
} | java | public Locale getLand() {
String kennung = this.getLandeskennung();
switch (kennung) {
case "D": return new Locale("de", "DE");
case "A": return new Locale("de", "AT");
case "CH": return new Locale("de", "CH");
default: throw new UnsupportedOperationException("unbekannte Landeskennung '" + kennung + "'");
}
} | [
"public",
"Locale",
"getLand",
"(",
")",
"{",
"String",
"kennung",
"=",
"this",
".",
"getLandeskennung",
"(",
")",
";",
"switch",
"(",
"kennung",
")",
"{",
"case",
"\"D\"",
":",
"return",
"new",
"Locale",
"(",
"\"de\"",
",",
"\"DE\"",
")",
";",
"case",... | Liefert das Land, die der Landeskennung entspricht.
@return z.B. "de_CH" (fuer die Schweiz) | [
"Liefert",
"das",
"Land",
"die",
"der",
"Landeskennung",
"entspricht",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/post/PLZ.java#L188-L196 | train |
DaGeRe/KoPeMe | kopeme-mojo/src/main/java/de/kopeme/mojo/KoPeMeMojo.java | KoPeMeMojo.getFiles | public List<File> getFiles(File dir, FileFilter filter) {
// System.out.println("Standardoutput: " + standardoutput);
List<File> files = new LinkedList<File>();
for (File f : dir.listFiles()) {
if (f.isFile()) {
if (filter.accept(f))
files.add(f);
} else {
files.addAll(getFiles(f, filter));
}
}
return files;
} | java | public List<File> getFiles(File dir, FileFilter filter) {
// System.out.println("Standardoutput: " + standardoutput);
List<File> files = new LinkedList<File>();
for (File f : dir.listFiles()) {
if (f.isFile()) {
if (filter.accept(f))
files.add(f);
} else {
files.addAll(getFiles(f, filter));
}
}
return files;
} | [
"public",
"List",
"<",
"File",
">",
"getFiles",
"(",
"File",
"dir",
",",
"FileFilter",
"filter",
")",
"{",
"//\t\tSystem.out.println(\"Standardoutput: \" + standardoutput);",
"List",
"<",
"File",
">",
"files",
"=",
"new",
"LinkedList",
"<",
"File",
">",
"(",
")"... | Returns a list with all files in the given Directory, matching the given
Filter
@param dir
Directory, where the files should be
@param filter
Filter, that the Files should match
@return list with all files in the given Directory, matching the given
Filter | [
"Returns",
"a",
"list",
"with",
"all",
"files",
"in",
"the",
"given",
"Directory",
"matching",
"the",
"given",
"Filter"
] | a4939113cba73cb20a2c7d6dc8d34d0139a3e340 | https://github.com/DaGeRe/KoPeMe/blob/a4939113cba73cb20a2c7d6dc8d34d0139a3e340/kopeme-mojo/src/main/java/de/kopeme/mojo/KoPeMeMojo.java#L97-L110 | train |
DaGeRe/KoPeMe | kopeme-mojo/src/main/java/de/kopeme/mojo/KoPeMeMojo.java | KoPeMeMojo.execute | public void execute() throws MojoExecutionException {
getLog().info("Start, BS: " + System.getProperty("os.name"));
if (System.getProperty("os.name").contains("indows")){
CPPATHSEPERATOR = ";";
PATHSEPERATOR="\\";
}else{
CPPATHSEPERATOR=":";
PATHSEPERATOR="/";
}
System.out.println("Execute: " + standardoutput);
tests = 0;
failure = 0;
error = 0;
if (standardoutput != null){
File output = new File(standardoutput);
try {
bw = new BufferedWriter( new FileWriter(output));
} catch (IOException e1) {
// TODO Automatisch generierter Erfassungsblock
e1.printStackTrace();
}
}
else{
File output = new File("stdout.txt");
try {
bw = new BufferedWriter( new FileWriter(output));
} catch (IOException e1) {
// TODO Automatisch generierter Erfassungsblock
e1.printStackTrace();
}
}
File dir = new File("src/test/java/");
FileFilter fileFilter = new RegexFileFilter("[A-z/]*.java$");
project = project.getExecutionProject();
runTestFile(dir, fileFilter);
getLog().info("Tests: " + tests + " Fehlschläge: " + failure
+ " Fehler: " + error);
} | java | public void execute() throws MojoExecutionException {
getLog().info("Start, BS: " + System.getProperty("os.name"));
if (System.getProperty("os.name").contains("indows")){
CPPATHSEPERATOR = ";";
PATHSEPERATOR="\\";
}else{
CPPATHSEPERATOR=":";
PATHSEPERATOR="/";
}
System.out.println("Execute: " + standardoutput);
tests = 0;
failure = 0;
error = 0;
if (standardoutput != null){
File output = new File(standardoutput);
try {
bw = new BufferedWriter( new FileWriter(output));
} catch (IOException e1) {
// TODO Automatisch generierter Erfassungsblock
e1.printStackTrace();
}
}
else{
File output = new File("stdout.txt");
try {
bw = new BufferedWriter( new FileWriter(output));
} catch (IOException e1) {
// TODO Automatisch generierter Erfassungsblock
e1.printStackTrace();
}
}
File dir = new File("src/test/java/");
FileFilter fileFilter = new RegexFileFilter("[A-z/]*.java$");
project = project.getExecutionProject();
runTestFile(dir, fileFilter);
getLog().info("Tests: " + tests + " Fehlschläge: " + failure
+ " Fehler: " + error);
} | [
"public",
"void",
"execute",
"(",
")",
"throws",
"MojoExecutionException",
"{",
"getLog",
"(",
")",
".",
"info",
"(",
"\"Start, BS: \"",
"+",
"System",
".",
"getProperty",
"(",
"\"os.name\"",
")",
")",
";",
"if",
"(",
"System",
".",
"getProperty",
"(",
"\"... | Main-method, that is executed when the tests are executed | [
"Main",
"-",
"method",
"that",
"is",
"executed",
"when",
"the",
"tests",
"are",
"executed"
] | a4939113cba73cb20a2c7d6dc8d34d0139a3e340 | https://github.com/DaGeRe/KoPeMe/blob/a4939113cba73cb20a2c7d6dc8d34d0139a3e340/kopeme-mojo/src/main/java/de/kopeme/mojo/KoPeMeMojo.java#L115-L159 | train |
hdbeukel/james-extensions | src/main/java/org/jamesframework/ext/problems/objectives/evaluations/WeightedIndexEvaluation.java | WeightedIndexEvaluation.addEvaluation | public void addEvaluation(Objective obj, Evaluation eval, double weight){
evaluations.put(obj, eval);
// update weighted sum
weightedSum += weight * eval.getValue();
} | java | public void addEvaluation(Objective obj, Evaluation eval, double weight){
evaluations.put(obj, eval);
// update weighted sum
weightedSum += weight * eval.getValue();
} | [
"public",
"void",
"addEvaluation",
"(",
"Objective",
"obj",
",",
"Evaluation",
"eval",
",",
"double",
"weight",
")",
"{",
"evaluations",
".",
"put",
"(",
"obj",
",",
"eval",
")",
";",
"// update weighted sum",
"weightedSum",
"+=",
"weight",
"*",
"eval",
".",... | Add an evaluation produced by an objective, specifying its weight.
@param obj objective
@param eval produced evaluation
@param weight assigned weight | [
"Add",
"an",
"evaluation",
"produced",
"by",
"an",
"objective",
"specifying",
"its",
"weight",
"."
] | 37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2 | https://github.com/hdbeukel/james-extensions/blob/37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2/src/main/java/org/jamesframework/ext/problems/objectives/evaluations/WeightedIndexEvaluation.java#L54-L58 | train |
DaGeRe/KoPeMe | kopeme-core/src/main/java/de/dagere/kopeme/datastorage/XMLDataLoader.java | XMLDataLoader.loadData | private void loadData() throws JAXBException {
if (file.exists()) {
final JAXBContext jc = JAXBContext.newInstance(Kopemedata.class);
final Unmarshaller unmarshaller = jc.createUnmarshaller();
data = (Kopemedata) unmarshaller.unmarshal(file);
LOG.trace("Daten geladen, Daten: " + data);
} else {
LOG.info("Datei {} existiert nicht", file.getAbsolutePath());
data = new Kopemedata();
data.setTestcases(new Testcases());
final Testcases tc = data.getTestcases();
LOG.trace("TC: " + tc);
tc.setClazz(file.getName());
}
} | java | private void loadData() throws JAXBException {
if (file.exists()) {
final JAXBContext jc = JAXBContext.newInstance(Kopemedata.class);
final Unmarshaller unmarshaller = jc.createUnmarshaller();
data = (Kopemedata) unmarshaller.unmarshal(file);
LOG.trace("Daten geladen, Daten: " + data);
} else {
LOG.info("Datei {} existiert nicht", file.getAbsolutePath());
data = new Kopemedata();
data.setTestcases(new Testcases());
final Testcases tc = data.getTestcases();
LOG.trace("TC: " + tc);
tc.setClazz(file.getName());
}
} | [
"private",
"void",
"loadData",
"(",
")",
"throws",
"JAXBException",
"{",
"if",
"(",
"file",
".",
"exists",
"(",
")",
")",
"{",
"final",
"JAXBContext",
"jc",
"=",
"JAXBContext",
".",
"newInstance",
"(",
"Kopemedata",
".",
"class",
")",
";",
"final",
"Unma... | Loads the data.
@throws JAXBException Thrown if the File countains errors | [
"Loads",
"the",
"data",
"."
] | a4939113cba73cb20a2c7d6dc8d34d0139a3e340 | https://github.com/DaGeRe/KoPeMe/blob/a4939113cba73cb20a2c7d6dc8d34d0139a3e340/kopeme-core/src/main/java/de/dagere/kopeme/datastorage/XMLDataLoader.java#L52-L67 | train |
DaGeRe/KoPeMe | kopeme-core/src/main/java/de/dagere/kopeme/datastorage/XMLDataLoader.java | XMLDataLoader.getData | public Map<String, Map<Date, Long>> getData(final String collectorName) {
final Map<String, Map<Date, Long>> map = new HashMap<>();
final Testcases testcases = data.getTestcases();
for (final TestcaseType tct : testcases.getTestcase()) {
final Map<Date, Long> measures = new HashMap<>();
final List<Datacollector> collectorMap = tct.getDatacollector();
Datacollector collector = null;
for (final Datacollector dc : collectorMap) {
if (dc.getName().equals(collectorName)) {
collector = dc;
}
}
if (collector == null) {
LOG.error("Achtung: Datenkollektor " + collectorName + " nicht vorhanden");
} else {
for (final Result s : collector.getResult()) {
measures.put(new Date(s.getDate()), (long) s.getValue());
}
map.put(tct.getName(), measures);
}
}
return map;
} | java | public Map<String, Map<Date, Long>> getData(final String collectorName) {
final Map<String, Map<Date, Long>> map = new HashMap<>();
final Testcases testcases = data.getTestcases();
for (final TestcaseType tct : testcases.getTestcase()) {
final Map<Date, Long> measures = new HashMap<>();
final List<Datacollector> collectorMap = tct.getDatacollector();
Datacollector collector = null;
for (final Datacollector dc : collectorMap) {
if (dc.getName().equals(collectorName)) {
collector = dc;
}
}
if (collector == null) {
LOG.error("Achtung: Datenkollektor " + collectorName + " nicht vorhanden");
} else {
for (final Result s : collector.getResult()) {
measures.put(new Date(s.getDate()), (long) s.getValue());
}
map.put(tct.getName(), measures);
}
}
return map;
} | [
"public",
"Map",
"<",
"String",
",",
"Map",
"<",
"Date",
",",
"Long",
">",
">",
"getData",
"(",
"final",
"String",
"collectorName",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"Map",
"<",
"Date",
",",
"Long",
">",
">",
"map",
"=",
"new",
"HashMap... | Returns a mapping from all testcases to their results for a certain collectorName.
@param collectorName The name of the collector for loading the Results
@return Mapping from all testcases to their results | [
"Returns",
"a",
"mapping",
"from",
"all",
"testcases",
"to",
"their",
"results",
"for",
"a",
"certain",
"collectorName",
"."
] | a4939113cba73cb20a2c7d6dc8d34d0139a3e340 | https://github.com/DaGeRe/KoPeMe/blob/a4939113cba73cb20a2c7d6dc8d34d0139a3e340/kopeme-core/src/main/java/de/dagere/kopeme/datastorage/XMLDataLoader.java#L89-L111 | train |
DaGeRe/KoPeMe | kopeme-core/src/main/java/de/dagere/kopeme/datastorage/XMLDataLoader.java | XMLDataLoader.getCollectors | public Set<String> getCollectors() {
final Set<String> collectors = new HashSet<String>();
final Testcases testcases = data.getTestcases();
for (final TestcaseType tct : testcases.getTestcase()) {
for (final Datacollector collector : tct.getDatacollector()) {
collectors.add(collector.getName());
}
}
return collectors;
} | java | public Set<String> getCollectors() {
final Set<String> collectors = new HashSet<String>();
final Testcases testcases = data.getTestcases();
for (final TestcaseType tct : testcases.getTestcase()) {
for (final Datacollector collector : tct.getDatacollector()) {
collectors.add(collector.getName());
}
}
return collectors;
} | [
"public",
"Set",
"<",
"String",
">",
"getCollectors",
"(",
")",
"{",
"final",
"Set",
"<",
"String",
">",
"collectors",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"final",
"Testcases",
"testcases",
"=",
"data",
".",
"getTestcases",
"(",
"... | Returns all datacollectors that are used in the resultfile.
@return Names of all datacollectors | [
"Returns",
"all",
"datacollectors",
"that",
"are",
"used",
"in",
"the",
"resultfile",
"."
] | a4939113cba73cb20a2c7d6dc8d34d0139a3e340 | https://github.com/DaGeRe/KoPeMe/blob/a4939113cba73cb20a2c7d6dc8d34d0139a3e340/kopeme-core/src/main/java/de/dagere/kopeme/datastorage/XMLDataLoader.java#L118-L127 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Comparing.java | Comparing.max | public static <T> T max(T lhs, T rhs, Comparator<T> comparator) {
return BinaryOperator.maxBy(comparator).apply(lhs, rhs);
} | java | public static <T> T max(T lhs, T rhs, Comparator<T> comparator) {
return BinaryOperator.maxBy(comparator).apply(lhs, rhs);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"max",
"(",
"T",
"lhs",
",",
"T",
"rhs",
",",
"Comparator",
"<",
"T",
">",
"comparator",
")",
"{",
"return",
"BinaryOperator",
".",
"maxBy",
"(",
"comparator",
")",
".",
"apply",
"(",
"lhs",
",",
"rhs",
")",
... | Evaluates max of two elements.
@param <T> the element type
@param lhs the left element
@param rhs the right element
@param comparator the comparator used to compare elements
@return the greater element | [
"Evaluates",
"max",
"of",
"two",
"elements",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Comparing.java#L25-L27 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Comparing.java | Comparing.max | public static <T extends Comparable<T>> T max(T lhs, T rhs) {
return BinaryOperator.maxBy(new ComparableComparator<T>()).apply(lhs, rhs);
} | java | public static <T extends Comparable<T>> T max(T lhs, T rhs) {
return BinaryOperator.maxBy(new ComparableComparator<T>()).apply(lhs, rhs);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"T",
"max",
"(",
"T",
"lhs",
",",
"T",
"rhs",
")",
"{",
"return",
"BinaryOperator",
".",
"maxBy",
"(",
"new",
"ComparableComparator",
"<",
"T",
">",
"(",
")",
")",
".",
"app... | Evaluates max of two comparable elements.
@param <T> the element type
@param lhs the left element
@param rhs the right element
@return the greater element | [
"Evaluates",
"max",
"of",
"two",
"comparable",
"elements",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Comparing.java#L37-L39 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Comparing.java | Comparing.min | public static <T> T min(T lhs, T rhs, Comparator<T> comparator) {
return BinaryOperator.minBy(comparator).apply(lhs, rhs);
} | java | public static <T> T min(T lhs, T rhs, Comparator<T> comparator) {
return BinaryOperator.minBy(comparator).apply(lhs, rhs);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"min",
"(",
"T",
"lhs",
",",
"T",
"rhs",
",",
"Comparator",
"<",
"T",
">",
"comparator",
")",
"{",
"return",
"BinaryOperator",
".",
"minBy",
"(",
"comparator",
")",
".",
"apply",
"(",
"lhs",
",",
"rhs",
")",
... | Evaluates min of two elements.
@param <T> the element type
@param lhs the left element
@param rhs the right element
@param comparator the comparator used to compare elements
@return the lesser element | [
"Evaluates",
"min",
"of",
"two",
"elements",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Comparing.java#L50-L52 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Comparing.java | Comparing.min | public static <T extends Comparable<T>> T min(T lhs, T rhs) {
return BinaryOperator.minBy(new ComparableComparator<T>()).apply(lhs, rhs);
} | java | public static <T extends Comparable<T>> T min(T lhs, T rhs) {
return BinaryOperator.minBy(new ComparableComparator<T>()).apply(lhs, rhs);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"T",
"min",
"(",
"T",
"lhs",
",",
"T",
"rhs",
")",
"{",
"return",
"BinaryOperator",
".",
"minBy",
"(",
"new",
"ComparableComparator",
"<",
"T",
">",
"(",
")",
")",
".",
"app... | Evaluates min of two comparable elements.
@param <T> the element type
@param lhs the left element
@param rhs the right element
@return the lesser element | [
"Evaluates",
"min",
"of",
"two",
"comparable",
"elements",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Comparing.java#L62-L64 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Comparing.java | Comparing.ordered | public static <T> Pair<T, T> ordered(T lhs, T rhs, Comparator<T> comparator) {
return new MakeOrder<T>(comparator).apply(lhs, rhs);
} | java | public static <T> Pair<T, T> ordered(T lhs, T rhs, Comparator<T> comparator) {
return new MakeOrder<T>(comparator).apply(lhs, rhs);
} | [
"public",
"static",
"<",
"T",
">",
"Pair",
"<",
"T",
",",
"T",
">",
"ordered",
"(",
"T",
"lhs",
",",
"T",
"rhs",
",",
"Comparator",
"<",
"T",
">",
"comparator",
")",
"{",
"return",
"new",
"MakeOrder",
"<",
"T",
">",
"(",
"comparator",
")",
".",
... | Returns the two elements ordered in a pair.
@param <T> the element type
@param lhs the left element
@param rhs the right element
@param comparator the comparator used to compare elements
@return the two elements ordered in a pair | [
"Returns",
"the",
"two",
"elements",
"ordered",
"in",
"a",
"pair",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Comparing.java#L75-L77 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Comparing.java | Comparing.ordered | public static <T extends Comparable<T>> Pair<T, T> ordered(T lhs, T rhs) {
return new MakeOrder<T>(new ComparableComparator<T>()).apply(lhs, rhs);
} | java | public static <T extends Comparable<T>> Pair<T, T> ordered(T lhs, T rhs) {
return new MakeOrder<T>(new ComparableComparator<T>()).apply(lhs, rhs);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"Pair",
"<",
"T",
",",
"T",
">",
"ordered",
"(",
"T",
"lhs",
",",
"T",
"rhs",
")",
"{",
"return",
"new",
"MakeOrder",
"<",
"T",
">",
"(",
"new",
"ComparableComparator",
"<",... | Returns the two comparable elements ordered in a pair.
@param <T> the element type
@param lhs the left element
@param rhs the right element
@return the two elements ordered in a pair | [
"Returns",
"the",
"two",
"comparable",
"elements",
"ordered",
"in",
"a",
"pair",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Comparing.java#L87-L89 | train |
hdbeukel/james-extensions | src/main/java/org/jamesframework/ext/permutation/PermutationSolution.java | PermutationSolution.swap | public void swap(int i, int j){
try{
// swap items
Collections.swap(order, i, j);
} catch (IndexOutOfBoundsException ex){
throw new SolutionModificationException("Error while modifying permutation solution: swapped positions should be positive "
+ "and smaller than the number of items in the permutation.", this);
}
} | java | public void swap(int i, int j){
try{
// swap items
Collections.swap(order, i, j);
} catch (IndexOutOfBoundsException ex){
throw new SolutionModificationException("Error while modifying permutation solution: swapped positions should be positive "
+ "and smaller than the number of items in the permutation.", this);
}
} | [
"public",
"void",
"swap",
"(",
"int",
"i",
",",
"int",
"j",
")",
"{",
"try",
"{",
"// swap items",
"Collections",
".",
"swap",
"(",
"order",
",",
"i",
",",
"j",
")",
";",
"}",
"catch",
"(",
"IndexOutOfBoundsException",
"ex",
")",
"{",
"throw",
"new",... | Swap the items at position i and j in the permutation.
Both positions should be positive and smaller than the
number of items in the permutation.
@param i position of first item to be swapped
@param j position of second item to be swapped
@throws SolutionModificationException if <code>i</code> or <code>j</code> is
= * negative, or larger than or equal to the
number of items in the permutation | [
"Swap",
"the",
"items",
"at",
"position",
"i",
"and",
"j",
"in",
"the",
"permutation",
".",
"Both",
"positions",
"should",
"be",
"positive",
"and",
"smaller",
"than",
"the",
"number",
"of",
"items",
"in",
"the",
"permutation",
"."
] | 37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2 | https://github.com/hdbeukel/james-extensions/blob/37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2/src/main/java/org/jamesframework/ext/permutation/PermutationSolution.java#L114-L122 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/post/Postfach.java | Postfach.validate | public static void validate(BigInteger nummer, Ort ort) {
if (nummer.compareTo(BigInteger.ONE) < 0) {
throw new InvalidValueException(nummer, "number");
}
validate(ort);
} | java | public static void validate(BigInteger nummer, Ort ort) {
if (nummer.compareTo(BigInteger.ONE) < 0) {
throw new InvalidValueException(nummer, "number");
}
validate(ort);
} | [
"public",
"static",
"void",
"validate",
"(",
"BigInteger",
"nummer",
",",
"Ort",
"ort",
")",
"{",
"if",
"(",
"nummer",
".",
"compareTo",
"(",
"BigInteger",
".",
"ONE",
")",
"<",
"0",
")",
"{",
"throw",
"new",
"InvalidValueException",
"(",
"nummer",
",",
... | Validiert das uebergebene Postfach auf moegliche Fehler.
@param nummer Postfach-Nummer (muss positiv sein)
@param ort Ort mit PLZ | [
"Validiert",
"das",
"uebergebene",
"Postfach",
"auf",
"moegliche",
"Fehler",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/post/Postfach.java#L230-L235 | train |
DaGeRe/KoPeMe | kopeme-core/src/main/java/de/dagere/kopeme/TimeBoundExecution.java | TimeBoundExecution.execute | public final boolean execute() throws Exception {
boolean finished = false;
mainThread.start();
mainThread.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
@Override
public void uncaughtException(final Thread arg0, final Throwable arg1) {
LOG.error("Uncaught exception in {}: {}", arg0.getName(), arg1.getClass());
testError = arg1;
}
});
LOG.debug("Warte: " + timeout);
mainThread.join(timeout);
if (mainThread.isAlive()) {
mainThread.setFinished(true);
LOG.error("Test " + type + " " + mainThread.getName() + " timed out!");
for (int i = 0; i < 5; i++) {
mainThread.interrupt();
// asure, that the test does not catch the interrupt state itself
Thread.sleep(5);
}
}
else {
finished = true;
}
mainThread.join(1000); // TODO If this time is shortened, test
if (mainThread.isAlive()) {
LOG.error("Test timed out and was not able to save his data after 10 seconds - is killed hard now.");
mainThread.stop();
}
if (testError != null) {
LOG.trace("Test error != null");
if (testError instanceof Exception) {
throw (Exception) testError;
} else if (testError instanceof Error) {
throw (Error) testError;
} else {
LOG.error("Unexpected behaviour");
testError.printStackTrace();
}
}
return finished;
} | java | public final boolean execute() throws Exception {
boolean finished = false;
mainThread.start();
mainThread.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
@Override
public void uncaughtException(final Thread arg0, final Throwable arg1) {
LOG.error("Uncaught exception in {}: {}", arg0.getName(), arg1.getClass());
testError = arg1;
}
});
LOG.debug("Warte: " + timeout);
mainThread.join(timeout);
if (mainThread.isAlive()) {
mainThread.setFinished(true);
LOG.error("Test " + type + " " + mainThread.getName() + " timed out!");
for (int i = 0; i < 5; i++) {
mainThread.interrupt();
// asure, that the test does not catch the interrupt state itself
Thread.sleep(5);
}
}
else {
finished = true;
}
mainThread.join(1000); // TODO If this time is shortened, test
if (mainThread.isAlive()) {
LOG.error("Test timed out and was not able to save his data after 10 seconds - is killed hard now.");
mainThread.stop();
}
if (testError != null) {
LOG.trace("Test error != null");
if (testError instanceof Exception) {
throw (Exception) testError;
} else if (testError instanceof Error) {
throw (Error) testError;
} else {
LOG.error("Unexpected behaviour");
testError.printStackTrace();
}
}
return finished;
} | [
"public",
"final",
"boolean",
"execute",
"(",
")",
"throws",
"Exception",
"{",
"boolean",
"finished",
"=",
"false",
";",
"mainThread",
".",
"start",
"(",
")",
";",
"mainThread",
".",
"setUncaughtExceptionHandler",
"(",
"new",
"UncaughtExceptionHandler",
"(",
")"... | Executes the TimeBoundedExecution.
@throws Exception
Thrown if an error occurs | [
"Executes",
"the",
"TimeBoundedExecution",
"."
] | a4939113cba73cb20a2c7d6dc8d34d0139a3e340 | https://github.com/DaGeRe/KoPeMe/blob/a4939113cba73cb20a2c7d6dc8d34d0139a3e340/kopeme-core/src/main/java/de/dagere/kopeme/TimeBoundExecution.java#L84-L125 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/bank/Geldbetrag.java | Geldbetrag.parse | public static Geldbetrag parse(CharSequence text, MonetaryAmountFormat formatter) {
return from(formatter.parse(text));
} | java | public static Geldbetrag parse(CharSequence text, MonetaryAmountFormat formatter) {
return from(formatter.parse(text));
} | [
"public",
"static",
"Geldbetrag",
"parse",
"(",
"CharSequence",
"text",
",",
"MonetaryAmountFormat",
"formatter",
")",
"{",
"return",
"from",
"(",
"formatter",
".",
"parse",
"(",
"text",
")",
")",
";",
"}"
] | Erzeugt einen Geldbetrag anhand des uebergebenen Textes und mittels
des uebergebenen Formatters.
@param text z.B. "12,25 EUR"
@param formatter Formatter
@return Geldbetrag | [
"Erzeugt",
"einen",
"Geldbetrag",
"anhand",
"des",
"uebergebenen",
"Textes",
"und",
"mittels",
"des",
"uebergebenen",
"Formatters",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/bank/Geldbetrag.java#L488-L490 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/bank/Geldbetrag.java | Geldbetrag.validate | public static String validate(String zahl) {
try {
return Geldbetrag.valueOf(zahl).toString();
} catch (IllegalArgumentException ex) {
throw new InvalidValueException(zahl, "money_amount", ex);
}
} | java | public static String validate(String zahl) {
try {
return Geldbetrag.valueOf(zahl).toString();
} catch (IllegalArgumentException ex) {
throw new InvalidValueException(zahl, "money_amount", ex);
}
} | [
"public",
"static",
"String",
"validate",
"(",
"String",
"zahl",
")",
"{",
"try",
"{",
"return",
"Geldbetrag",
".",
"valueOf",
"(",
"zahl",
")",
".",
"toString",
"(",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"ex",
")",
"{",
"throw",
"new"... | Validiert die uebergebene Zahl, ob sie sich als Geldbetrag eignet.
@param zahl als String
@return die Zahl zur Weitervarabeitung | [
"Validiert",
"die",
"uebergebene",
"Zahl",
"ob",
"sie",
"sich",
"als",
"Geldbetrag",
"eignet",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/bank/Geldbetrag.java#L553-L559 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/bank/Geldbetrag.java | Geldbetrag.validate | public static BigDecimal validate(BigDecimal zahl, CurrencyUnit currency) {
if (zahl.scale() == 0) {
return zahl.setScale(currency.getDefaultFractionDigits(), RoundingMode.HALF_UP);
}
return zahl;
} | java | public static BigDecimal validate(BigDecimal zahl, CurrencyUnit currency) {
if (zahl.scale() == 0) {
return zahl.setScale(currency.getDefaultFractionDigits(), RoundingMode.HALF_UP);
}
return zahl;
} | [
"public",
"static",
"BigDecimal",
"validate",
"(",
"BigDecimal",
"zahl",
",",
"CurrencyUnit",
"currency",
")",
"{",
"if",
"(",
"zahl",
".",
"scale",
"(",
")",
"==",
"0",
")",
"{",
"return",
"zahl",
".",
"setScale",
"(",
"currency",
".",
"getDefaultFraction... | Validiert die uebergebene Zahl.
@param zahl als String
@param currency die Waehrung
@return die Zahl zur Weitervarabeitung | [
"Validiert",
"die",
"uebergebene",
"Zahl",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/bank/Geldbetrag.java#L568-L573 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/bank/Geldbetrag.java | Geldbetrag.query | @Override
public <R> R query(MonetaryQuery<R> query) {
Objects.requireNonNull(query);
try {
return query.queryFrom(this);
} catch (MonetaryException ex) {
throw ex;
} catch (RuntimeException ex) {
throw new LocalizedMonetaryException("query failed", query, ex);
}
} | java | @Override
public <R> R query(MonetaryQuery<R> query) {
Objects.requireNonNull(query);
try {
return query.queryFrom(this);
} catch (MonetaryException ex) {
throw ex;
} catch (RuntimeException ex) {
throw new LocalizedMonetaryException("query failed", query, ex);
}
} | [
"@",
"Override",
"public",
"<",
"R",
">",
"R",
"query",
"(",
"MonetaryQuery",
"<",
"R",
">",
"query",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"query",
")",
";",
"try",
"{",
"return",
"query",
".",
"queryFrom",
"(",
"this",
")",
";",
"}",
"... | Fraegt einen Wert an.
@param query Anrfage (nicht null)
@return Ergebnis der Anfrage (kann null sein)
@see javax.money.MonetaryAmount#query(javax.money.MonetaryQuery) | [
"Fraegt",
"einen",
"Wert",
"an",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/bank/Geldbetrag.java#L1275-L1285 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/bank/Geldbetrag.java | Geldbetrag.toLongString | public String toLongString() {
NumberFormat formatter = DecimalFormat.getInstance();
formatter.setMinimumFractionDigits(context.getMaxScale());
formatter.setMinimumFractionDigits(context.getMaxScale());
return formatter.format(betrag) + " " + currency;
} | java | public String toLongString() {
NumberFormat formatter = DecimalFormat.getInstance();
formatter.setMinimumFractionDigits(context.getMaxScale());
formatter.setMinimumFractionDigits(context.getMaxScale());
return formatter.format(betrag) + " " + currency;
} | [
"public",
"String",
"toLongString",
"(",
")",
"{",
"NumberFormat",
"formatter",
"=",
"DecimalFormat",
".",
"getInstance",
"(",
")",
";",
"formatter",
".",
"setMinimumFractionDigits",
"(",
"context",
".",
"getMaxScale",
"(",
")",
")",
";",
"formatter",
".",
"se... | Hier wird der Geldbetrag mit voller Genauigkeit ausgegeben.
@return z.B. "19.0012 USD" | [
"Hier",
"wird",
"der",
"Geldbetrag",
"mit",
"voller",
"Genauigkeit",
"ausgegeben",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/bank/Geldbetrag.java#L1318-L1323 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Compositions.java | Compositions.compose | public static <T2, T1, R> Function<T1, R> compose(Function<T2, R> f, Function<T1, T2> g) {
dbc.precondition(f != null, "cannot compose a null function");
dbc.precondition(g != null, "cannot compose a null function");
return f.compose(g);
} | java | public static <T2, T1, R> Function<T1, R> compose(Function<T2, R> f, Function<T1, T2> g) {
dbc.precondition(f != null, "cannot compose a null function");
dbc.precondition(g != null, "cannot compose a null function");
return f.compose(g);
} | [
"public",
"static",
"<",
"T2",
",",
"T1",
",",
"R",
">",
"Function",
"<",
"T1",
",",
"R",
">",
"compose",
"(",
"Function",
"<",
"T2",
",",
"R",
">",
"f",
",",
"Function",
"<",
"T1",
",",
"T2",
">",
"g",
")",
"{",
"dbc",
".",
"precondition",
"... | Composes a function with another function.
Given f, g yields f ° g (f of g, f following g).
@param <T2> f parameter type and g return type
@param <T1> g parameter type
@param <R> f return type
@param f the first function to be composed
@param g the second function to be composed
@return the composed function | [
"Composes",
"a",
"function",
"with",
"another",
"function",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Compositions.java#L51-L55 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Compositions.java | Compositions.compose | public static <T1, T2, T3, R> BiFunction<T1, T2, R> compose(Function<T3, R> unary, BiFunction<T1, T2, T3> binary) {
dbc.precondition(unary != null, "cannot compose a null unary function");
dbc.precondition(binary != null, "cannot compose a null binary function");
return binary.andThen(unary);
} | java | public static <T1, T2, T3, R> BiFunction<T1, T2, R> compose(Function<T3, R> unary, BiFunction<T1, T2, T3> binary) {
dbc.precondition(unary != null, "cannot compose a null unary function");
dbc.precondition(binary != null, "cannot compose a null binary function");
return binary.andThen(unary);
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"R",
">",
"BiFunction",
"<",
"T1",
",",
"T2",
",",
"R",
">",
"compose",
"(",
"Function",
"<",
"T3",
",",
"R",
">",
"unary",
",",
"BiFunction",
"<",
"T1",
",",
"T2",
",",
"T3",
">",
"bi... | Composes a function with a binary function.
@param <T1> the first binary parameter type
@param <T2> the second binary parameter type
@param <T3> unary parameter type and binary return type
@param <R> unary return type
@param unary the function to be composed
@param binary the binary function to be composed
@return the composed binary function | [
"Composes",
"a",
"function",
"with",
"a",
"binary",
"function",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Compositions.java#L89-L93 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Compositions.java | Compositions.compose | public static <T1, T2, T3, T4, R> TriFunction<T1, T2, T3, R> compose(Function<T4, R> unary, TriFunction<T1, T2, T3, T4> ternary) {
dbc.precondition(unary != null, "cannot compose a null unary function");
dbc.precondition(ternary != null, "cannot compose a null ternary function");
return ternary.andThen(unary);
} | java | public static <T1, T2, T3, T4, R> TriFunction<T1, T2, T3, R> compose(Function<T4, R> unary, TriFunction<T1, T2, T3, T4> ternary) {
dbc.precondition(unary != null, "cannot compose a null unary function");
dbc.precondition(ternary != null, "cannot compose a null ternary function");
return ternary.andThen(unary);
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"R",
">",
"TriFunction",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"R",
">",
"compose",
"(",
"Function",
"<",
"T4",
",",
"R",
">",
"unary",
",",
"TriFunction",
"<",
"T1",
",",
"... | Composes a function with a ternary function.
@param <T1> the first ternary parameter type
@param <T2> the second ternary parameter type
@param <T3> the third ternary parameter type
@param <T4> unary parameter type and ternary return type
@param <R> unary return type
@param unary the unary function to be composed
@param ternary the ternary function to be composed
@return the composed ternary function | [
"Composes",
"a",
"function",
"with",
"a",
"ternary",
"function",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Compositions.java#L107-L111 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Compositions.java | Compositions.compose | public static <T> UnaryOperator<T> compose(Iterator<Function<T, T>> endodelegates) {
return new UnaryOperatorsComposer<T>().apply(endodelegates);
} | java | public static <T> UnaryOperator<T> compose(Iterator<Function<T, T>> endodelegates) {
return new UnaryOperatorsComposer<T>().apply(endodelegates);
} | [
"public",
"static",
"<",
"T",
">",
"UnaryOperator",
"<",
"T",
">",
"compose",
"(",
"Iterator",
"<",
"Function",
"<",
"T",
",",
"T",
">",
">",
"endodelegates",
")",
"{",
"return",
"new",
"UnaryOperatorsComposer",
"<",
"T",
">",
"(",
")",
".",
"apply",
... | Composes an iterator of endofunctions.
@param <T> the functions parameter and result type
@param endodelegates to be composed (e.g: f,g,h)
@return a function performing f ° g ° h | [
"Composes",
"an",
"iterator",
"of",
"endofunctions",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Compositions.java#L168-L170 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Logic.java | Logic.or | public static <T1, T2> BiPredicate<T1, T2> or(BiPredicate<T1, T2> first, BiPredicate<T1, T2> second, BiPredicate<T1, T2> third) {
dbc.precondition(first != null, "first predicate is null");
dbc.precondition(second != null, "second predicate is null");
dbc.precondition(third != null, "third predicate is null");
return Logic.Binary.or(Iterations.iterable(first, second, third));
} | java | public static <T1, T2> BiPredicate<T1, T2> or(BiPredicate<T1, T2> first, BiPredicate<T1, T2> second, BiPredicate<T1, T2> third) {
dbc.precondition(first != null, "first predicate is null");
dbc.precondition(second != null, "second predicate is null");
dbc.precondition(third != null, "third predicate is null");
return Logic.Binary.or(Iterations.iterable(first, second, third));
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
">",
"BiPredicate",
"<",
"T1",
",",
"T2",
">",
"or",
"(",
"BiPredicate",
"<",
"T1",
",",
"T2",
">",
"first",
",",
"BiPredicate",
"<",
"T1",
",",
"T2",
">",
"second",
",",
"BiPredicate",
"<",
"T1",
",",
"T... | Creates a composite OR predicate from the given predicates.
@param <T1> the former element type parameter
@param <T2> the latter element type parameter
@param first
@param second
@param third
@return the composite predicate | [
"Creates",
"a",
"composite",
"OR",
"predicate",
"from",
"the",
"given",
"predicates",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Logic.java#L452-L457 | train |
jpbetz/cli-util | src/main/java/jpbetz/cli/CommandContext.java | CommandContext.parse | @SuppressWarnings("unchecked") // marshall from apache commons cli
private void parse() throws ParseException {
_argValues = new HashMap<Argument, String>();
_varargValues = new ArrayList<String>();
List<String> argList = _commandLine.getArgList();
int required = 0;
boolean hasOptional = false;
boolean hasVarargs = false;
for(Argument argument : _arguments.getArguments()) {
if(argument.isRequired()) {
required++;
} else {
hasOptional = true;
}
if(argument.isVararg()) {
hasVarargs = true;
}
}
int allowed = hasOptional? required+1 : required;
if(argList.size() < required) {
throw new ParseException("Not enough arguments provided. " + required + " required, but only " + argList.size() + " provided.");
}
if(!hasVarargs) {
if(argList.size() > allowed) {
throw new ParseException("Too many arguments provided. Only " + allowed + " allowed, but " + argList.size() + " provided.");
}
}
int index = 0;
boolean finalArgEncountered = false;
for(Argument argument : _arguments.getArguments()) {
if(finalArgEncountered) throw new IllegalStateException("Illegal arguments defined. No additional arguments may be defined after first optional or vararg argument.");
if(argument.isRequired() && !argument.isVararg()) { // the normal case
if(index <= argList.size()) {
_argValues.put(argument, argList.get(index));
} else {
throw new IllegalStateException("not enough arguments"); // should not happen given above size check
}
}
else { // it's the last argument, either it's optional or a vararg
finalArgEncountered = true;
if(argument.isVararg()) {
_varargValues = argList.subList(Math.min(index, argList.size()), argList.size());
if(argument.isRequired() && _varargValues.size() < 1) {
throw new IllegalStateException("not enough arguments"); // should not happen given above size check
}
}
else { // if it's a optional
if(index < argList.size()) {
_argValues.put(argument, argList.get(index));
}
}
}
index++;
}
} | java | @SuppressWarnings("unchecked") // marshall from apache commons cli
private void parse() throws ParseException {
_argValues = new HashMap<Argument, String>();
_varargValues = new ArrayList<String>();
List<String> argList = _commandLine.getArgList();
int required = 0;
boolean hasOptional = false;
boolean hasVarargs = false;
for(Argument argument : _arguments.getArguments()) {
if(argument.isRequired()) {
required++;
} else {
hasOptional = true;
}
if(argument.isVararg()) {
hasVarargs = true;
}
}
int allowed = hasOptional? required+1 : required;
if(argList.size() < required) {
throw new ParseException("Not enough arguments provided. " + required + " required, but only " + argList.size() + " provided.");
}
if(!hasVarargs) {
if(argList.size() > allowed) {
throw new ParseException("Too many arguments provided. Only " + allowed + " allowed, but " + argList.size() + " provided.");
}
}
int index = 0;
boolean finalArgEncountered = false;
for(Argument argument : _arguments.getArguments()) {
if(finalArgEncountered) throw new IllegalStateException("Illegal arguments defined. No additional arguments may be defined after first optional or vararg argument.");
if(argument.isRequired() && !argument.isVararg()) { // the normal case
if(index <= argList.size()) {
_argValues.put(argument, argList.get(index));
} else {
throw new IllegalStateException("not enough arguments"); // should not happen given above size check
}
}
else { // it's the last argument, either it's optional or a vararg
finalArgEncountered = true;
if(argument.isVararg()) {
_varargValues = argList.subList(Math.min(index, argList.size()), argList.size());
if(argument.isRequired() && _varargValues.size() < 1) {
throw new IllegalStateException("not enough arguments"); // should not happen given above size check
}
}
else { // if it's a optional
if(index < argList.size()) {
_argValues.put(argument, argList.get(index));
}
}
}
index++;
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"// marshall from apache commons cli",
"private",
"void",
"parse",
"(",
")",
"throws",
"ParseException",
"{",
"_argValues",
"=",
"new",
"HashMap",
"<",
"Argument",
",",
"String",
">",
"(",
")",
";",
"_varargValue... | Parses and verifies the command line options.
@throws ParseException | [
"Parses",
"and",
"verifies",
"the",
"command",
"line",
"options",
"."
] | f05ee1c9085583f972393ade5392330c59bc6c1e | https://github.com/jpbetz/cli-util/blob/f05ee1c9085583f972393ade5392330c59bc6c1e/src/main/java/jpbetz/cli/CommandContext.java#L39-L101 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/pruefung/NumberValidator.java | NumberValidator.normalize | public String normalize(String value) {
if (!value.matches("[\\d,.]+([eE]\\d+)?")) {
throw new InvalidValueException(value, NUMBER);
}
Locale locale = guessLocale(value);
DecimalFormat df = (DecimalFormat) DecimalFormat.getInstance(locale);
df.setParseBigDecimal(true);
try {
return df.parse(value).toString();
} catch (ParseException ex) {
throw new InvalidValueException(value, NUMBER, ex);
}
} | java | public String normalize(String value) {
if (!value.matches("[\\d,.]+([eE]\\d+)?")) {
throw new InvalidValueException(value, NUMBER);
}
Locale locale = guessLocale(value);
DecimalFormat df = (DecimalFormat) DecimalFormat.getInstance(locale);
df.setParseBigDecimal(true);
try {
return df.parse(value).toString();
} catch (ParseException ex) {
throw new InvalidValueException(value, NUMBER, ex);
}
} | [
"public",
"String",
"normalize",
"(",
"String",
"value",
")",
"{",
"if",
"(",
"!",
"value",
".",
"matches",
"(",
"\"[\\\\d,.]+([eE]\\\\d+)?\"",
")",
")",
"{",
"throw",
"new",
"InvalidValueException",
"(",
"value",
",",
"NUMBER",
")",
";",
"}",
"Locale",
"l... | Normalisiert einen String, sodass er zur Generierung einer Zahl
herangezogen werden kann.
@param value z.B. "1,234.5"
@return normalisiert, z.B. "1234.5" | [
"Normalisiert",
"einen",
"String",
"sodass",
"er",
"zur",
"Generierung",
"einer",
"Zahl",
"herangezogen",
"werden",
"kann",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/pruefung/NumberValidator.java#L104-L116 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/pruefung/Mod10Verfahren.java | Mod10Verfahren.isValid | @Override
public boolean isValid(String wert) {
if (StringUtils.length(wert) < 1) {
return false;
} else {
return getPruefziffer(wert).equals(berechnePruefziffer(wert.substring(0, wert.length() - 1)));
}
} | java | @Override
public boolean isValid(String wert) {
if (StringUtils.length(wert) < 1) {
return false;
} else {
return getPruefziffer(wert).equals(berechnePruefziffer(wert.substring(0, wert.length() - 1)));
}
} | [
"@",
"Override",
"public",
"boolean",
"isValid",
"(",
"String",
"wert",
")",
"{",
"if",
"(",
"StringUtils",
".",
"length",
"(",
"wert",
")",
"<",
"1",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"return",
"getPruefziffer",
"(",
"wert",
")",
"... | Liefert true zurueck, wenn der uebergebene Wert gueltig ist.
@param wert Fachwert oder gekapselter Wert
@return true oder false | [
"Liefert",
"true",
"zurueck",
"wenn",
"der",
"uebergebene",
"Wert",
"gueltig",
"ist",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/pruefung/Mod10Verfahren.java#L96-L103 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/math/PackedDecimal.java | PackedDecimal.isBruch | public boolean isBruch() {
String s = toString();
if (s.contains("/")) {
try {
Bruch.of(s);
return true;
} catch (IllegalArgumentException ex) {
LOG.fine(s + " is not a fraction: " + ex);
return false;
}
} else {
return false;
}
} | java | public boolean isBruch() {
String s = toString();
if (s.contains("/")) {
try {
Bruch.of(s);
return true;
} catch (IllegalArgumentException ex) {
LOG.fine(s + " is not a fraction: " + ex);
return false;
}
} else {
return false;
}
} | [
"public",
"boolean",
"isBruch",
"(",
")",
"{",
"String",
"s",
"=",
"toString",
"(",
")",
";",
"if",
"(",
"s",
".",
"contains",
"(",
"\"/\"",
")",
")",
"{",
"try",
"{",
"Bruch",
".",
"of",
"(",
"s",
")",
";",
"return",
"true",
";",
"}",
"catch",... | Liefert true zurueck, wenn die Zahl als Bruch angegeben ist.
@return true oder false | [
"Liefert",
"true",
"zurueck",
"wenn",
"die",
"Zahl",
"als",
"Bruch",
"angegeben",
"ist",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/math/PackedDecimal.java#L325-L338 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/math/PackedDecimal.java | PackedDecimal.movePointLeft | public PackedDecimal movePointLeft(int n) {
BigDecimal result = toBigDecimal().movePointLeft(n);
return PackedDecimal.valueOf(result);
} | java | public PackedDecimal movePointLeft(int n) {
BigDecimal result = toBigDecimal().movePointLeft(n);
return PackedDecimal.valueOf(result);
} | [
"public",
"PackedDecimal",
"movePointLeft",
"(",
"int",
"n",
")",
"{",
"BigDecimal",
"result",
"=",
"toBigDecimal",
"(",
")",
".",
"movePointLeft",
"(",
"n",
")",
";",
"return",
"PackedDecimal",
".",
"valueOf",
"(",
"result",
")",
";",
"}"
] | Verschiebt den Dezimalpunkt um n Stellen nach links.
@param n Anzahl Stellen
@return eine neue {@link PackedDecimal} | [
"Verschiebt",
"den",
"Dezimalpunkt",
"um",
"n",
"Stellen",
"nach",
"links",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/math/PackedDecimal.java#L538-L541 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/math/PackedDecimal.java | PackedDecimal.movePointRight | public PackedDecimal movePointRight(int n) {
BigDecimal result = toBigDecimal().movePointRight(n);
return PackedDecimal.valueOf(result);
} | java | public PackedDecimal movePointRight(int n) {
BigDecimal result = toBigDecimal().movePointRight(n);
return PackedDecimal.valueOf(result);
} | [
"public",
"PackedDecimal",
"movePointRight",
"(",
"int",
"n",
")",
"{",
"BigDecimal",
"result",
"=",
"toBigDecimal",
"(",
")",
".",
"movePointRight",
"(",
"n",
")",
";",
"return",
"PackedDecimal",
".",
"valueOf",
"(",
"result",
")",
";",
"}"
] | Verschiebt den Dezimalpunkt um n Stellen nach rechts.
@param n Anzahl Stellen
@return eine neue {@link PackedDecimal} | [
"Verschiebt",
"den",
"Dezimalpunkt",
"um",
"n",
"Stellen",
"nach",
"rechts",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/math/PackedDecimal.java#L549-L552 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/math/PackedDecimal.java | PackedDecimal.setScale | public PackedDecimal setScale(int n, RoundingMode mode) {
BigDecimal result = toBigDecimal().setScale(n, mode);
return PackedDecimal.valueOf(result);
} | java | public PackedDecimal setScale(int n, RoundingMode mode) {
BigDecimal result = toBigDecimal().setScale(n, mode);
return PackedDecimal.valueOf(result);
} | [
"public",
"PackedDecimal",
"setScale",
"(",
"int",
"n",
",",
"RoundingMode",
"mode",
")",
"{",
"BigDecimal",
"result",
"=",
"toBigDecimal",
"(",
")",
".",
"setScale",
"(",
"n",
",",
"mode",
")",
";",
"return",
"PackedDecimal",
".",
"valueOf",
"(",
"result"... | Setzt die Anzahl der Nachkommastellen.
@param n z.B. 0, falls keine Nachkommastelle gesetzt sein soll
@param mode Rundungs-Mode
@return eine neue {@link PackedDecimal} | [
"Setzt",
"die",
"Anzahl",
"der",
"Nachkommastellen",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/math/PackedDecimal.java#L561-L564 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Dispatching.java | Dispatching.curry | public static <T> Runnable curry(Consumer<T> consumer, T value) {
dbc.precondition(consumer != null, "cannot bind parameter of a null consumer");
return () -> consumer.accept(value);
} | java | public static <T> Runnable curry(Consumer<T> consumer, T value) {
dbc.precondition(consumer != null, "cannot bind parameter of a null consumer");
return () -> consumer.accept(value);
} | [
"public",
"static",
"<",
"T",
">",
"Runnable",
"curry",
"(",
"Consumer",
"<",
"T",
">",
"consumer",
",",
"T",
"value",
")",
"{",
"dbc",
".",
"precondition",
"(",
"consumer",
"!=",
"null",
",",
"\"cannot bind parameter of a null consumer\"",
")",
";",
"return... | Partial application of the first parameter to an consumer.
@param <T> the consumer parameter type
@param consumer the consumer to be curried
@param value the value to be curried
@return the curried runnable | [
"Partial",
"application",
"of",
"the",
"first",
"parameter",
"to",
"an",
"consumer",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Dispatching.java#L35-L38 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Dispatching.java | Dispatching.curry | public static <T1, T2> Consumer<T2> curry(BiConsumer<T1, T2> consumer, T1 first) {
dbc.precondition(consumer != null, "cannot bind parameter of a null consumer");
return second -> consumer.accept(first, second);
} | java | public static <T1, T2> Consumer<T2> curry(BiConsumer<T1, T2> consumer, T1 first) {
dbc.precondition(consumer != null, "cannot bind parameter of a null consumer");
return second -> consumer.accept(first, second);
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
">",
"Consumer",
"<",
"T2",
">",
"curry",
"(",
"BiConsumer",
"<",
"T1",
",",
"T2",
">",
"consumer",
",",
"T1",
"first",
")",
"{",
"dbc",
".",
"precondition",
"(",
"consumer",
"!=",
"null",
",",
"\"cannot bind... | Partial application of the first parameter to a binary consumer.
@param <T1> the consumer former parameter type
@param <T2> the consumer latter parameter type
@param consumer the binary consumer to be curried
@param first the value to be curried as first parameter
@return the curried unary consumer | [
"Partial",
"application",
"of",
"the",
"first",
"parameter",
"to",
"a",
"binary",
"consumer",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Dispatching.java#L49-L52 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Dispatching.java | Dispatching.curry | public static <T> BooleanSupplier curry(Predicate<T> predicate, T value) {
dbc.precondition(predicate != null, "cannot bind parameter of a null predicate");
return () -> predicate.test(value);
} | java | public static <T> BooleanSupplier curry(Predicate<T> predicate, T value) {
dbc.precondition(predicate != null, "cannot bind parameter of a null predicate");
return () -> predicate.test(value);
} | [
"public",
"static",
"<",
"T",
">",
"BooleanSupplier",
"curry",
"(",
"Predicate",
"<",
"T",
">",
"predicate",
",",
"T",
"value",
")",
"{",
"dbc",
".",
"precondition",
"(",
"predicate",
"!=",
"null",
",",
"\"cannot bind parameter of a null predicate\"",
")",
";"... | Partial application of the parameter to a predicate.
@param <T> the predicate parameter type
@param predicate the predicate to be curried
@param value the value to be curried
@return the curried proposition | [
"Partial",
"application",
"of",
"the",
"parameter",
"to",
"a",
"predicate",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Dispatching.java#L77-L80 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Dispatching.java | Dispatching.curry | public static <T1, T2, T3> BiPredicate<T2, T3> curry(TriPredicate<T1, T2, T3> predicate, T1 first) {
dbc.precondition(predicate != null, "cannot bind parameter of a null predicate");
return (second, third) -> predicate.test(first, second, third);
} | java | public static <T1, T2, T3> BiPredicate<T2, T3> curry(TriPredicate<T1, T2, T3> predicate, T1 first) {
dbc.precondition(predicate != null, "cannot bind parameter of a null predicate");
return (second, third) -> predicate.test(first, second, third);
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
">",
"BiPredicate",
"<",
"T2",
",",
"T3",
">",
"curry",
"(",
"TriPredicate",
"<",
"T1",
",",
"T2",
",",
"T3",
">",
"predicate",
",",
"T1",
"first",
")",
"{",
"dbc",
".",
"precondition",
"(",
"p... | Partial application of the first parameter to a ternary predicate.
@param <T1> the predicate first parameter type
@param <T2> the predicate second parameter type
@param <T3> the predicate third parameter type
@param predicate the predicate to be curried
@param first the value to be curried as first parameter
@return the curried binary predicate | [
"Partial",
"application",
"of",
"the",
"first",
"parameter",
"to",
"a",
"ternary",
"predicate",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Dispatching.java#L106-L109 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Dispatching.java | Dispatching.curry | public static <T, R> Supplier<R> curry(Function<T, R> function, T value) {
dbc.precondition(function != null, "cannot bind parameter of a null function");
return () -> function.apply(value);
} | java | public static <T, R> Supplier<R> curry(Function<T, R> function, T value) {
dbc.precondition(function != null, "cannot bind parameter of a null function");
return () -> function.apply(value);
} | [
"public",
"static",
"<",
"T",
",",
"R",
">",
"Supplier",
"<",
"R",
">",
"curry",
"(",
"Function",
"<",
"T",
",",
"R",
">",
"function",
",",
"T",
"value",
")",
"{",
"dbc",
".",
"precondition",
"(",
"function",
"!=",
"null",
",",
"\"cannot bind paramet... | Partial application of the parameter to a function.
@param <T> the function parameter type
@param <R> the function return type
@param function the function to be curried
@param value the value to be curried
@return the curried supplier | [
"Partial",
"application",
"of",
"the",
"parameter",
"to",
"a",
"function",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Dispatching.java#L120-L123 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Dispatching.java | Dispatching.curry | public static <T1, T2, R> Function<T2, R> curry(BiFunction<T1, T2, R> function, T1 first) {
dbc.precondition(function != null, "cannot bind parameter of a null function");
return second -> function.apply(first, second);
} | java | public static <T1, T2, R> Function<T2, R> curry(BiFunction<T1, T2, R> function, T1 first) {
dbc.precondition(function != null, "cannot bind parameter of a null function");
return second -> function.apply(first, second);
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"R",
">",
"Function",
"<",
"T2",
",",
"R",
">",
"curry",
"(",
"BiFunction",
"<",
"T1",
",",
"T2",
",",
"R",
">",
"function",
",",
"T1",
"first",
")",
"{",
"dbc",
".",
"precondition",
"(",
"function",... | Partial application of the first parameter to a binary function.
@param <T1> the function first parameter type
@param <T2> the function second parameter type
@param <R> the function return type
@param function the function to be curried
@param first the value to be curried as first parameter
@return the curried function | [
"Partial",
"application",
"of",
"the",
"first",
"parameter",
"to",
"a",
"binary",
"function",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Dispatching.java#L135-L138 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Dispatching.java | Dispatching.curry | public static <T1, T2, T3, R> BiFunction<T2, T3, R> curry(TriFunction<T1, T2, T3, R> function, T1 first) {
dbc.precondition(function != null, "cannot bind parameter of a null function");
return (second, third) -> function.apply(first, second, third);
} | java | public static <T1, T2, T3, R> BiFunction<T2, T3, R> curry(TriFunction<T1, T2, T3, R> function, T1 first) {
dbc.precondition(function != null, "cannot bind parameter of a null function");
return (second, third) -> function.apply(first, second, third);
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"R",
">",
"BiFunction",
"<",
"T2",
",",
"T3",
",",
"R",
">",
"curry",
"(",
"TriFunction",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"R",
">",
"function",
",",
"T1",
"first",
")",
"{",
"dbc... | Partial application of the first parameter to a ternary function.
@param <T1> the function first parameter type
@param <T2> the function second parameter type
@param <T3> the function third parameter type
@param <R> the function return type
@param function the function to be curried
@param first the value to be curried as first parameter
@return the curried binary function | [
"Partial",
"application",
"of",
"the",
"first",
"parameter",
"to",
"a",
"ternary",
"function",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Dispatching.java#L151-L154 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Dispatching.java | Dispatching.ignore | public static <T> Predicate<T> ignore(BooleanSupplier proposition, Class<T> ignored) {
dbc.precondition(proposition != null, "cannot ignore parameter of a null proposition");
return t -> proposition.getAsBoolean();
} | java | public static <T> Predicate<T> ignore(BooleanSupplier proposition, Class<T> ignored) {
dbc.precondition(proposition != null, "cannot ignore parameter of a null proposition");
return t -> proposition.getAsBoolean();
} | [
"public",
"static",
"<",
"T",
">",
"Predicate",
"<",
"T",
">",
"ignore",
"(",
"BooleanSupplier",
"proposition",
",",
"Class",
"<",
"T",
">",
"ignored",
")",
"{",
"dbc",
".",
"precondition",
"(",
"proposition",
"!=",
"null",
",",
"\"cannot ignore parameter of... | Adapts a proposition to a predicate by ignoring the passed parameter.
@param <T> the predicate parameter type
@param proposition the proposition to be adapted
@param ignored the adapted predicate parameter type class
@return the adapted predicate | [
"Adapts",
"a",
"proposition",
"to",
"a",
"predicate",
"by",
"ignoring",
"the",
"passed",
"parameter",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Dispatching.java#L309-L312 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Dispatching.java | Dispatching.ignore2nd | public static <T1, T2> BiPredicate<T1, T2> ignore2nd(Predicate<T1> predicate, Class<T2> ignored) {
dbc.precondition(predicate != null, "cannot ignore parameter of a null predicate");
return (first, second) -> predicate.test(first);
} | java | public static <T1, T2> BiPredicate<T1, T2> ignore2nd(Predicate<T1> predicate, Class<T2> ignored) {
dbc.precondition(predicate != null, "cannot ignore parameter of a null predicate");
return (first, second) -> predicate.test(first);
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
">",
"BiPredicate",
"<",
"T1",
",",
"T2",
">",
"ignore2nd",
"(",
"Predicate",
"<",
"T1",
">",
"predicate",
",",
"Class",
"<",
"T2",
">",
"ignored",
")",
"{",
"dbc",
".",
"precondition",
"(",
"predicate",
"!="... | Adapts a predicate to a binary predicate by ignoring second parameter.
@param <T1> the adapted predicate first parameter type
@param <T2> the adapted predicate second parameter type
@param predicate the predicate to be adapted
@param ignored the adapted predicate ignored parameter type class
@return the adapted binary predicate | [
"Adapts",
"a",
"predicate",
"to",
"a",
"binary",
"predicate",
"by",
"ignoring",
"second",
"parameter",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Dispatching.java#L353-L356 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Dispatching.java | Dispatching.ignore2nd | public static <T1, T2, T3> TriPredicate<T1, T2, T3> ignore2nd(BiPredicate<T1, T3> predicate, Class<T2> ignored) {
dbc.precondition(predicate != null, "cannot ignore parameter of a null predicate");
return (first, second, third) -> predicate.test(first, third);
} | java | public static <T1, T2, T3> TriPredicate<T1, T2, T3> ignore2nd(BiPredicate<T1, T3> predicate, Class<T2> ignored) {
dbc.precondition(predicate != null, "cannot ignore parameter of a null predicate");
return (first, second, third) -> predicate.test(first, third);
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
">",
"TriPredicate",
"<",
"T1",
",",
"T2",
",",
"T3",
">",
"ignore2nd",
"(",
"BiPredicate",
"<",
"T1",
",",
"T3",
">",
"predicate",
",",
"Class",
"<",
"T2",
">",
"ignored",
")",
"{",
"dbc",
"."... | Adapts a binary predicate to a ternary predicate by ignoring second
parameter.
@param <T1> the adapted predicate first parameter type
@param <T2> the adapted predicate second parameter type
@param <T3> the adapted predicate third parameter type
@param predicate the predicate to be adapted
@param ignored the adapted predicate ignored parameter type class
@return the adapted ternary predicate | [
"Adapts",
"a",
"binary",
"predicate",
"to",
"a",
"ternary",
"predicate",
"by",
"ignoring",
"second",
"parameter",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Dispatching.java#L369-L372 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Dispatching.java | Dispatching.ignore | public static <T> Consumer<T> ignore(Runnable runnable, Class<T> ignored) {
dbc.precondition(runnable != null, "cannot ignore parameter of a null runnable");
return first -> runnable.run();
} | java | public static <T> Consumer<T> ignore(Runnable runnable, Class<T> ignored) {
dbc.precondition(runnable != null, "cannot ignore parameter of a null runnable");
return first -> runnable.run();
} | [
"public",
"static",
"<",
"T",
">",
"Consumer",
"<",
"T",
">",
"ignore",
"(",
"Runnable",
"runnable",
",",
"Class",
"<",
"T",
">",
"ignored",
")",
"{",
"dbc",
".",
"precondition",
"(",
"runnable",
"!=",
"null",
",",
"\"cannot ignore parameter of a null runnab... | Adapts a runnable to an consumer by ignoring the parameter.
@param <T> the adapted consumer parameter type
@param runnable the runnable to be adapted
@param ignored the adapted consumer ignored parameter type class
@return the adapted consumer | [
"Adapts",
"a",
"runnable",
"to",
"an",
"consumer",
"by",
"ignoring",
"the",
"parameter",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Dispatching.java#L398-L401 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Dispatching.java | Dispatching.ignore1st | public static <T1, T2> BiConsumer<T1, T2> ignore1st(Consumer<T2> consumer, Class<T1> ignored) {
dbc.precondition(consumer != null, "cannot ignore parameter of a null consumer");
return (first, second) -> consumer.accept(second);
} | java | public static <T1, T2> BiConsumer<T1, T2> ignore1st(Consumer<T2> consumer, Class<T1> ignored) {
dbc.precondition(consumer != null, "cannot ignore parameter of a null consumer");
return (first, second) -> consumer.accept(second);
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
">",
"BiConsumer",
"<",
"T1",
",",
"T2",
">",
"ignore1st",
"(",
"Consumer",
"<",
"T2",
">",
"consumer",
",",
"Class",
"<",
"T1",
">",
"ignored",
")",
"{",
"dbc",
".",
"precondition",
"(",
"consumer",
"!=",
... | Adapts an consumer to a binary consumer by ignoring the first parameter.
@param <T1> the adapted consumer first parameter type
@param <T2> the adapted consumer second parameter type
@param consumer the consumer to be adapted
@param ignored the adapted consumer ignored parameter type class
@return the adapted binary consumer | [
"Adapts",
"an",
"consumer",
"to",
"a",
"binary",
"consumer",
"by",
"ignoring",
"the",
"first",
"parameter",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Dispatching.java#L412-L415 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Dispatching.java | Dispatching.ignore3rd | public static <T1, T2, T3> TriConsumer<T1, T2, T3> ignore3rd(BiConsumer<T1, T2> consumer, Class<T3> ignored) {
dbc.precondition(consumer != null, "cannot ignore parameter of a null consumer");
return (first, second, third) -> consumer.accept(first, second);
} | java | public static <T1, T2, T3> TriConsumer<T1, T2, T3> ignore3rd(BiConsumer<T1, T2> consumer, Class<T3> ignored) {
dbc.precondition(consumer != null, "cannot ignore parameter of a null consumer");
return (first, second, third) -> consumer.accept(first, second);
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
">",
"TriConsumer",
"<",
"T1",
",",
"T2",
",",
"T3",
">",
"ignore3rd",
"(",
"BiConsumer",
"<",
"T1",
",",
"T2",
">",
"consumer",
",",
"Class",
"<",
"T3",
">",
"ignored",
")",
"{",
"dbc",
".",
... | Adapts a binary consumer to a ternary consumer by ignoring the third
parameter.
@param <T1> the adapted consumer first parameter type
@param <T2> the adapted consumer second parameter type
@param <T3> the adapted consumer third parameter type
@param consumer the consumer to be adapted
@param ignored the adapted consumer ignored parameter type class
@return the adapted ternary consumer | [
"Adapts",
"a",
"binary",
"consumer",
"to",
"a",
"ternary",
"consumer",
"by",
"ignoring",
"the",
"third",
"parameter",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Dispatching.java#L474-L477 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Dispatching.java | Dispatching.ignore | public static <T, R> Function<T, R> ignore(Supplier<R> supplier, Class<T> ignored) {
dbc.precondition(supplier != null, "cannot ignore parameter of a null supplier");
return first -> supplier.get();
} | java | public static <T, R> Function<T, R> ignore(Supplier<R> supplier, Class<T> ignored) {
dbc.precondition(supplier != null, "cannot ignore parameter of a null supplier");
return first -> supplier.get();
} | [
"public",
"static",
"<",
"T",
",",
"R",
">",
"Function",
"<",
"T",
",",
"R",
">",
"ignore",
"(",
"Supplier",
"<",
"R",
">",
"supplier",
",",
"Class",
"<",
"T",
">",
"ignored",
")",
"{",
"dbc",
".",
"precondition",
"(",
"supplier",
"!=",
"null",
"... | Adapts a supplier to a function by ignoring the passed parameter.
@param <T> the adapted function parameter type
@param <R> the adapted function result type
@param supplier the supplier to be adapted
@param ignored the adapted function ignored parameter type class
@return the adapted function | [
"Adapts",
"a",
"supplier",
"to",
"a",
"function",
"by",
"ignoring",
"the",
"passed",
"parameter",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Dispatching.java#L488-L491 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Dispatching.java | Dispatching.ignore1st | public static <T1, T2, R> BiFunction<T1, T2, R> ignore1st(Function<T2, R> function, Class<T1> ignored) {
dbc.precondition(function != null, "cannot ignore parameter of a null function");
return (first, second) -> function.apply(second);
} | java | public static <T1, T2, R> BiFunction<T1, T2, R> ignore1st(Function<T2, R> function, Class<T1> ignored) {
dbc.precondition(function != null, "cannot ignore parameter of a null function");
return (first, second) -> function.apply(second);
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"R",
">",
"BiFunction",
"<",
"T1",
",",
"T2",
",",
"R",
">",
"ignore1st",
"(",
"Function",
"<",
"T2",
",",
"R",
">",
"function",
",",
"Class",
"<",
"T1",
">",
"ignored",
")",
"{",
"dbc",
".",
"prec... | Adapts a function to a binary function by ignoring the first parameter.
@param <T1> the adapted function first parameter type
@param <T2> the adapted function second parameter type
@param <R> the adapted function result type
@param function the function to be adapted
@param ignored the adapted function ignored parameter type class
@return the adapted function | [
"Adapts",
"a",
"function",
"to",
"a",
"binary",
"function",
"by",
"ignoring",
"the",
"first",
"parameter",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Dispatching.java#L503-L506 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Dispatching.java | Dispatching.ignore1st | public static <T1, T2, T3, R> TriFunction<T1, T2, T3, R> ignore1st(BiFunction<T2, T3, R> function, Class<T1> ignored) {
dbc.precondition(function != null, "cannot ignore parameter of a null function");
return (first, second, third) -> function.apply(second, third);
} | java | public static <T1, T2, T3, R> TriFunction<T1, T2, T3, R> ignore1st(BiFunction<T2, T3, R> function, Class<T1> ignored) {
dbc.precondition(function != null, "cannot ignore parameter of a null function");
return (first, second, third) -> function.apply(second, third);
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"R",
">",
"TriFunction",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"R",
">",
"ignore1st",
"(",
"BiFunction",
"<",
"T2",
",",
"T3",
",",
"R",
">",
"function",
",",
"Class",
"<",
"T1",
">",
... | Adapts a binary function to a ternary function by ignoring the first
parameter.
@param <T1> the adapted function first parameter type
@param <T2> the adapted function second parameter type
@param <T3> the adapted function third parameter type
@param <R> the adapted function result type
@param function the function to be adapted
@param ignored the adapted function ignored parameter type class
@return the adapted function | [
"Adapts",
"a",
"binary",
"function",
"to",
"a",
"ternary",
"function",
"by",
"ignoring",
"the",
"first",
"parameter",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Dispatching.java#L520-L523 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Dispatching.java | Dispatching.supplier | public static <T> Supplier<Optional<T>> supplier(Iterator<T> adaptee) {
return new IteratingSupplier<T>(adaptee);
} | java | public static <T> Supplier<Optional<T>> supplier(Iterator<T> adaptee) {
return new IteratingSupplier<T>(adaptee);
} | [
"public",
"static",
"<",
"T",
">",
"Supplier",
"<",
"Optional",
"<",
"T",
">",
">",
"supplier",
"(",
"Iterator",
"<",
"T",
">",
"adaptee",
")",
"{",
"return",
"new",
"IteratingSupplier",
"<",
"T",
">",
"(",
"adaptee",
")",
";",
"}"
] | Adapts an iterator to a supplier.
@param adaptee the runnable to be adapted
@return the adapted supplier | [
"Adapts",
"an",
"iterator",
"to",
"a",
"supplier",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Dispatching.java#L580-L582 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Dispatching.java | Dispatching.supplier | public static Supplier<Void> supplier(Runnable adaptee) {
dbc.precondition(adaptee != null, "cannot adapt a null runnable");
return () -> {
adaptee.run();
return null;
};
} | java | public static Supplier<Void> supplier(Runnable adaptee) {
dbc.precondition(adaptee != null, "cannot adapt a null runnable");
return () -> {
adaptee.run();
return null;
};
} | [
"public",
"static",
"Supplier",
"<",
"Void",
">",
"supplier",
"(",
"Runnable",
"adaptee",
")",
"{",
"dbc",
".",
"precondition",
"(",
"adaptee",
"!=",
"null",
",",
"\"cannot adapt a null runnable\"",
")",
";",
"return",
"(",
")",
"->",
"{",
"adaptee",
".",
... | Adapts a runnable to a supplier.
@param adaptee the runnable to be adapted
@return the adapted supplier | [
"Adapts",
"a",
"runnable",
"to",
"a",
"supplier",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Dispatching.java#L590-L596 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Dispatching.java | Dispatching.supplier | public static Supplier<Boolean> supplier(BooleanSupplier adaptee) {
dbc.precondition(adaptee != null, "cannot adapt a null boolean supplier");
return () -> adaptee.getAsBoolean();
} | java | public static Supplier<Boolean> supplier(BooleanSupplier adaptee) {
dbc.precondition(adaptee != null, "cannot adapt a null boolean supplier");
return () -> adaptee.getAsBoolean();
} | [
"public",
"static",
"Supplier",
"<",
"Boolean",
">",
"supplier",
"(",
"BooleanSupplier",
"adaptee",
")",
"{",
"dbc",
".",
"precondition",
"(",
"adaptee",
"!=",
"null",
",",
"\"cannot adapt a null boolean supplier\"",
")",
";",
"return",
"(",
")",
"->",
"adaptee"... | Adapts a proposition to a supplier.
@param adaptee the proposition to be adapted
@return the adapted supplier | [
"Adapts",
"a",
"proposition",
"to",
"a",
"supplier",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Dispatching.java#L604-L607 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.