Exemple #1
0
        /// <summary>
        /// Is the gate combination applicable
        /// </summary>
        /// <param name="context">gate context</param>
        /// <param name="gates">applicable gate, always set if the gate combination is applicable</param>
        /// <returns>true if at least one gate is applicable</returns>
        public override bool IsApplicable(IGateContext context, out IGate[] gates)
        {
            gates = null;
            if (context == null)
            {
                return(false);
            }

            IGate gate = Array.Find(Gates, t => context.IsGateApplicable(t));

            if (gate != null)
            {
                gates = new[] { gate };
                return(true);
            }

            return(false);
        }
Exemple #2
0
        /// <summary>
        /// Checks for gate applicability
        /// </summary>
        /// <param name="context">The current gate context.</param>
        /// <param name="gates">A collection containing the applicable gates.</param>
        /// <returns>True if all the gates are applicable, false otherwise.</returns>
        public override bool IsApplicable(IGateContext context, out IGate[] gates)
        {
            gates = null;

            if (context == null)
            {
                return(false);
            }

            if (Array.Exists(Gates, t => !context.IsGateApplicable(t)))
            {
                return(false);
            }

            if (Gates != null && Gates.Length != 0)
            {
                gates = Gates;
                return(true);
            }

            return(false);
        }