internal BidirectionalTraverserIterator(Resource resource, MonoDirectionalTraversalDescription start, MonoDirectionalTraversalDescription end, SideSelectorPolicy sideSelector, Org.Neo4j.Graphdb.traversal.BranchCollisionPolicy collisionPolicy, PathEvaluator collisionEvaluator, int maxDepth, IEnumerable <Node> startNodes, IEnumerable <Node> endNodes) : base(resource)
        {
            this._sides[Direction.OUTGOING] = new Side(start);
            this._sides[Direction.INCOMING] = new Side(end);
            this._uniqueness = MakeSureStartAndEndHasSameUniqueness(start, end);

            // A little chicken-and-egg problem. This happens when constructing the start/end
            // selectors and they initially call evaluate() and isUniqueFirst, where the selector is used.
            // Solved this way for now, to have it return the start side to begin with.
            this._selector = FixedSide(Direction.OUTGOING);
            BranchSelector startSelector = start.BranchOrdering.create(new AsOneStartBranch(this, startNodes, start.InitialState, start.UniquenessConflict), start.Expander);

            this._selector = FixedSide(Direction.INCOMING);
            BranchSelector endSelector = end.BranchOrdering.create(new AsOneStartBranch(this, endNodes, end.InitialState, start.UniquenessConflict), end.Expander);

            this._selector          = sideSelector.Create(startSelector, endSelector, maxDepth);
            this._collisionDetector = collisionPolicy.Create(collisionEvaluator, _uniqueness.checkFull);
        }
        private BidirectionalUniquenessFilter MakeSureStartAndEndHasSameUniqueness(MonoDirectionalTraversalDescription start, MonoDirectionalTraversalDescription end)
        {
            if (!start.UniquenessConflict.Equals(end.UniquenessConflict))
            {
                throw new System.ArgumentException("Start and end uniqueness factories differ, they need to be the " + "same currently. Start side has " + start.UniquenessConflict + ", end side has " + end.UniquenessConflict);
            }

            bool parameterDiffers = start.UniquenessParameter == null || end.UniquenessParameter == null ? start.UniquenessParameter != end.UniquenessParameter :!start.UniquenessParameter.Equals(end.UniquenessParameter);

            if (parameterDiffers)
            {
                throw new System.ArgumentException("Start and end uniqueness parameters differ, they need to be the " + "same currently. Start side has " + start.UniquenessParameter + ", " + "end side has " + end.UniquenessParameter);
            }

            UniquenessFilter uniqueness = start.UniquenessConflict.create(start.UniquenessParameter);

            if (!(uniqueness is BidirectionalUniquenessFilter))
            {
                throw new System.ArgumentException("You must supply a BidirectionalUniquenessFilter, " + "not just a UniquenessFilter.");
            }
            return(( BidirectionalUniquenessFilter )uniqueness);
        }
 internal Side(MonoDirectionalTraversalDescription description)
 {
     this.Description = description;
 }