// Path: src/joquery/core/JoinMode.java
// public enum JoinMode
// {
//     INNER,
//     LEFT_OUTER,
//     RIGHT_OUTER
// }
// 
// Path: src/joquery/core/QueryException.java
// public class QueryException extends Exception
// {
//     public QueryException(String message)
//     {
//         super(message);
//     }
// 
//     public QueryException(String message, Throwable cause)
//     {
//         super(message, cause);
//     }
// }


import joquery.*;
import joquery.core.JoinMode;
import joquery.core.QueryException;
import java.util.Collection;
import java.util.function.Function;
    }

    @Override
    public <X,Y> JoinQuery<U,X,Y> innerJoin(ResultTransformedQuery<X, X, ?> rightQuery) throws QueryException
    {
        return doJoin(JoinMode.INNER,rightQuery);
    }

    @Override
    public <X, Y> JoinQuery<U, X, Y> leftOuterJoin(ResultTransformedQuery<X, X, ?> rightQuery) throws QueryException
    {
        return doJoin(JoinMode.LEFT_OUTER,rightQuery);
    }

    @Override
    public <X, Y> JoinQuery<U, X, Y> rightOuterJoin(ResultTransformedQuery<X, X, ?> rightQuery) throws QueryException
    {
        return doJoin(JoinMode.RIGHT_OUTER,rightQuery);
    }

    @Override
    public <Key> GroupQuery<Key,U> group() throws QueryException
    {
        return new GroupQueryImpl<>(list());
    }

    private <X, Y> JoinQuery<U, X, Y> doJoin(JoinMode joinMode,ResultTransformedQuery<X, X, ?> rightQuery) throws QueryException
    {
        if (getSelections().size() > 0)
        {
// Path: src/joquery/core/JoinMode.java
// public enum JoinMode
// {
//     INNER,
//     LEFT_OUTER,
//     RIGHT_OUTER
// }
// 
// Path: src/joquery/core/QueryException.java
// public class QueryException extends Exception
// {
//     public QueryException(String message)
//     {
//         super(message);
//     }
// 
//     public QueryException(String message, Throwable cause)
//     {
//         super(message, cause);
//     }
// }


// Path: src/joquery/core/collection/ResultTransformedQueryImpl.java
import joquery.*;
import joquery.core.JoinMode;
import joquery.core.QueryException;
import java.util.Collection;
import java.util.function.Function;

    }

    @Override
    public <X,Y> JoinQuery<U,X,Y> innerJoin(ResultTransformedQuery<X, X, ?> rightQuery) throws QueryException
    {
        return doJoin(JoinMode.INNER,rightQuery);
    }

    @Override
    public <X, Y> JoinQuery<U, X, Y> leftOuterJoin(ResultTransformedQuery<X, X, ?> rightQuery) throws QueryException
    {
        return doJoin(JoinMode.LEFT_OUTER,rightQuery);
    }

    @Override
    public <X, Y> JoinQuery<U, X, Y> rightOuterJoin(ResultTransformedQuery<X, X, ?> rightQuery) throws QueryException
    {
        return doJoin(JoinMode.RIGHT_OUTER,rightQuery);
    }

    @Override
    public <Key> GroupQuery<Key,U> group() throws QueryException
    {
        return new GroupQueryImpl<>(list());
    }

    private <X, Y> JoinQuery<U, X, Y> doJoin(JoinMode joinMode,ResultTransformedQuery<X, X, ?> rightQuery) throws QueryException
    {
        if (getSelections().size() > 0)
        {
            throw new QueryException("Join is not possible when there is a transformation");