Skip to content

Instantly share code, notes, and snippets.

public final class Example
{
private static final String DB_PROPERTIES = "/db.properties";
private static final String DB_URL;
private static final String DB_USERNAME;
private static final String DB_PASSWORD;
static {
final CharsetDecoder decoder = StandardCharsets.UTF_8.newDecoder()
.onMalformedInput(CodingErrorAction.REPORT)
protected Iterator<Object[]> parsingData()
{
final List<Object[]> list = new ArrayList<>();
String input;
List<TokenType> tokens;
input = "\"\"";
tokens = Collections.<TokenType>singletonList(Strings.LITERAL);
list.add(new Object[] { input, tokens });
input = "((1 # 3) \\ -2) + (004 * \"2 horses\")";
tokens = Arrays.<TokenType>asList(Symbols.LPAREN, Symbols.LPAREN,
Numbers.LITERAL, BinaryOps.MODULUS, Numbers.LITERAL, Symbols.RPAREN,
BinaryOps.INT_DIVIDE, UnaryOps.MINUS, Numbers.LITERAL,
Symbols.RPAREN, BinaryOps.ADD, Symbols.LPAREN, Numbers.LITERAL,
BinaryOps.MULTIPLY, Strings.LITERAL, Symbols.RPAREN);
list.add(new Object[] { input, tokens });
/*
* Copyright (c) 2015, Francis Galiegue (fgaliegue@gmail.com)
*
* This software is dual-licensed under:
*
* - the Lesser General Public License (LGPL) version 3.0 or, at your option, any
* later version;
* - the Apache Software License (ASL) version 2.0.
*
* The text of this file and of both licenses is available at the root of this
public final class MatchesData
{
private static final Comparator<MatchStatistics> STATISTICS_COMPARATOR
= (o1, o2) -> {
final int c1 = nrMatches(o1);
final int c2 = nrMatches(o2);
return Integer.compare(c2, c1);
};
private int nonEmptyMatches = 0;
public MatchesData getMatchesData()
{
final Field<Integer> emptyMatches = DSL.decode()
.when(EMPTY_MATCHES_CONDITION, 1).otherwise(0);
final Field<Integer> nonEmptyMatches = DSL.decode()
.when(NONEMPTY_MATCHES_CONDITION, 1).otherwise(0);
final Field<Integer> failedMatches = DSL.decode()
.when(FAILED_MATCHES_CONDITION, 1).otherwise(0);
return jooq.select(MATCHERS.NAME, MATCHERS.MATCHER_TYPE,
package com.github.fge.lambdas.function;
import com.github.fge.lambdas.ThrowablesFactory;
import com.github.fge.lambdas.Chain;
import java.util.function.Function;
public final class FunctionChain<T, R>
extends Chain<Function<T, R>, ThrowingFunction<T, R>, FunctionChain<T, R>>
implements ThrowingFunction<T, R>
package com.github.fge.lambdas.function;
import com.github.fge.lambdas.ThrowablesFactory;
import com.github.fge.lambdas.Chain;
import java.util.function.Function;
public final class FunctionChain<T, R>
extends Chain<Function<T, R>, ThrowingFunction<T, R>, FunctionChain<T, R>>
implements ThrowingFunction<T, R>
package com.github.fge.lambdas.function;
import com.github.fge.lambdas.ThrownByLambdaException;
import java.util.function.Function;
@FunctionalInterface
public interface ThrowingFunction<T, R>
extends Function<T, R>
{
package com.github.fge.lambdas;
public abstract class Chain<N, T extends N, C extends Chain<N, T, C>>
{
protected final T throwing;
protected Chain(final T throwing)
{
this.throwing = throwing;
}