Ejemplo n.º 1
0
        private static CompoundCondition CombineWithAnd(IReadOnlyCollection <Condition> operations)
        {
            if (operations.Count < 0)
            {
                throw new InvalidOperationException();
            }

            var conditions = new CompoundCondition(Operator.And);

            foreach (Condition condition in operations)
            {
                conditions.And(condition);
            }

            return(conditions);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Combines all definitions of the <paramref name="scope"/> with and
        /// </summary>
        /// <param name="scope">The scope where the definitions should be combined</param>
        /// <returns>A with and combined filter definition of all definitions of the scope</returns>
        protected static Condition CombineOperationsOfScope(Neo4JFilterScope scope)
        {
            Queue <Condition> level = scope.Level.Peek();

            if (level.Count == 1)
            {
                return(level.Peek());
            }

            var conditions = new CompoundCondition(Operator.And);

            foreach (Condition condition in level)
            {
                conditions.And(condition);
            }

            return(conditions);
        }
Ejemplo n.º 3
0
        public static bool TryCreateQuery(
            this Neo4JFilterScope scope,
            [NotNullWhen(true)] out CompoundCondition query)
        {
            query = null;

            if (scope.Level.Peek().Count == 0)
            {
                return(false);
            }

            var conditions = new CompoundCondition(Operator.And);

            foreach (Condition condition in scope.Level.Peek().ToArray())
            {
                conditions.And(condition);
            }

            query = conditions;

            return(true);
        }