Esempio n. 1
0
        public override bool ContinuePipeLineEntry <TA, TB>(
            IValueAndSupplement <TA, TB> pipeInput,
            out PipeBase <TA, TB> wrapInputIntoPipeBase,
            out IPipeOption pipeOption)
        {
            if (pipeInput == null)
            {
                pipeOption            = new PipeOption(null, null);
                wrapInputIntoPipeBase = new None <TA, TB>(pipeOption);
                return(false);
            }
            pipeOption = (IPipeOption)pipeInput;

            if (pipeInput.GetType() == typeof(Option <TA, TB>))
            {
                wrapInputIntoPipeBase = new None <TA, TB>(pipeOption);
                return(false);
            }
            if (pipeInput.GetType() == typeof(SomeException <TA, TB>))
            {
                wrapInputIntoPipeBase = new SomeException <TA, TB>(((SomeException <TA, TB>)pipeInput).ExceptionVal, pipeOption);
                return(false);
            }
            if (pipeInput.GetType() == typeof(Validation <TA, TB>))
            {
                wrapInputIntoPipeBase = new Validation <TA, TB>(new ValueAndSupplement <TA, TB>(pipeInput.Val, pipeInput.SupplementVal), pipeOption, ((Validation <TV, TS>)pipeInput).ValidationRet);
                return(false);
            }

            wrapInputIntoPipeBase = new Some <TA, TB>(new ValueAndSupplement <TA, TB>(pipeInput.Val, pipeInput.SupplementVal), pipeOption);
            return(true);
        }
Esempio n. 2
0
 public abstract bool ContinuePipeLineEntry <TA, TB, TC, TD>(
     IValueAndSupplement <TA, TB> pipeInput,
     out PipeBase <TC, TD> wrapInputIntoPipeBaseWhenBreak,
     out IPipeOption pipeOption)
     where TA : new()
     where TB : new()
     where TC : new()
     where TD : new();
Esempio n. 3
0
 public override bool ValidateIsValid <TA, TB>(PipeBase <TA, TB> source, out PipeBase <TA, TB> pipeBaseValidated)
 {
     pipeBaseValidated = source;
     if (source.Val != null && source.Val is IInvariant <TA> && !((IInvariant <TA>)source.Val).IsValid)
     {
         pipeBaseValidated = new Validation <TA, TB>(new ValueAndSupplement <TA, TB>(source.Val, source.SupplementVal), new PipeOption(null, null), ((IInvariant <TV>)source.Val).ToValidationResult());
         return(false);
     }
     if (source.SupplementVal != null && source.SupplementVal is IInvariant <TS> && !((IInvariant <TS>)source.SupplementVal).IsValid)
     {
         pipeBaseValidated = new Validation <TA, TB>(new ValueAndSupplement <TA, TB>(source.Val, source.SupplementVal), new PipeOption(null, null), ((IInvariant <TS>)source.SupplementVal).ToValidationResult());
         return(false);
     }
     return(true);
 }
Esempio n. 4
0
        public override bool ContinuePipeLineEntry <TA, TB, TC, TD>(
            IValueAndSupplement <TA, TB> pipeInput,
            out PipeBase <TC, TD> wrapInputIntoPipeBaseWhenBreak,
            out IPipeOption pipeOption)
        {
            //Determine pipeBaseWhenContinue
            if (pipeInput == null)
            {
                pipeOption = new PipeOption(null, null);
            }
            else
            {
                pipeOption = (IPipeOption)pipeInput;
            }


            //Determine pipeBaseWhenBreak
            if (pipeInput.GetType() == typeof(Option <TA, TB>))
            {
                wrapInputIntoPipeBaseWhenBreak = new None <TC, TD>(pipeOption);
                return(false);
            }
            if (pipeInput.GetType() == typeof(SomeException <TA, TB>))
            {
                wrapInputIntoPipeBaseWhenBreak = new SomeException <TC, TD>(((SomeException <TA, TB>)pipeInput).ExceptionVal, pipeOption);
                return(false);
            }

            if (pipeInput.GetType() == typeof(Validation <TA, TB>))
            {
                wrapInputIntoPipeBaseWhenBreak = new Validation <TC, TD>(new ValueAndSupplement <TC, TD>(default(TC), default(TD)), pipeOption, ((Validation <TC, TD>)pipeInput).ValidationRet);
                return(false);
            }

            //Because of the out signature we need to instantiate a pipeBaseWhenBreak, but it will be ignored because we return true, meaning don't break
            wrapInputIntoPipeBaseWhenBreak = new Some <TC, TD>(new ValueAndSupplement <TC, TD>(default(TC), default(TD)), pipeOption);
            return(true);
        }
Esempio n. 5
0
 public abstract bool ValidateIsValid <TA, TB>(
     PipeBase <TA, TB> source,
     out PipeBase <TA, TB> pipeBaseValidated)
     where TA : new()
     where TB : new();
Esempio n. 6
0
 public abstract bool ContinuePipeLineEntry <TB, TA>(
     IValueAndSupplement <TA, TB> pipeInput,
     out PipeBase <TB, TA> wrapInputIntoPipeBase,
     out IPipeOption pipeOption)
     where TA : new()
     where TB : new();