Azavea.Open.DAO.Criteria.Joins.DaoJoinCriteria.Flip C# (CSharp) Method

Flip() public method

For some implementations, it's simpler to only implement one-sided joins. So to handle right (or left) joins, you want to flip the criteria so the right and left daos are swapped and you can do a left (or right) join instead.
public Flip ( ) : DaoJoinCriteria
return DaoJoinCriteria
        public DaoJoinCriteria Flip()
        {
            DaoJoinCriteria retVal = new DaoJoinCriteria();
            switch (TypeOfJoin)
            {
                case JoinType.LeftOuter:
                    retVal.TypeOfJoin = JoinType.RightOuter;
                    break;
                case JoinType.RightOuter:
                    retVal.TypeOfJoin = JoinType.LeftOuter;
                    break;
                default:
                    throw new NotSupportedException("Cannot flip a criteria with join type: " + TypeOfJoin);
            }
            if (_log.IsDebugEnabled)
            {
                _log.Debug("Flipping criteria: " + this +
                           ".  There is a potential performance gain if you can write your original join as type: " +
                           retVal.TypeOfJoin);
            }
            retVal.BoolType = BoolType;
            foreach (IJoinExpression expr in Expressions)
            {
                retVal.Expressions.Add(expr.Flip());
            }
            foreach (JoinSortOrder order in Orders)
            {
                retVal.Orders.Add(order.Flip());
            }
            return retVal;
        }