Algorithmix.MatchData.IsFit C# (CSharp) Метод

IsFit() приватный статический Метод

IsFit checks if given a specified side, it can be fit with a shreds's edge This Also returns a match object
private static IsFit ( INode root, Shred shred, Side side ) : Direction>.Tuple
root INode
shred Shred
side Side
Результат Direction>.Tuple
        private static Tuple<Match, Direction> IsFit(INode root, Shred shred, Side side)
        {
            Side query;
            Match match;

            if (side.Orientation != shred.Orientation)
            {
                query = new Side(shred, Enumeration.Opposite(side.Direction), shred.Orientation);
                match = Match.Inverted;
            }
            else
            {
                query = side;
                match = Match.NonInverted;
            }

            // If Directions match AND The Availablility then return match, otherwise impossible
            if (query.Direction == Direction.FromLeft && root.LeftEdge() == shred.LeftEdge())
            {
                return new Tuple<Match, Direction>(match, Direction.FromLeft);
            }
            if (query.Direction == Direction.FromRight && root.RightEdge() == shred.RightEdge())
            {
                return new Tuple<Match, Direction>(match, Direction.FromRight);
            }
            return new Tuple<Match, Direction>(Match.Impossible, Direction.FromLeft);
        }