예제 #1
0
        IAdvancedCategoryObject IBifunctor.CalculateObject(IAdvancedCategoryObject obj1, IAdvancedCategoryObject obj2)
        {
            IList <IAdvancedCategoryArrow>  l = new List <IAdvancedCategoryArrow>();
            IList <IAdvancedCategoryObject> o = new List <IAdvancedCategoryObject>();

            o.Add(obj1);
            o.Add(obj2);
            return(category.GetDirectProduct(o, l));
        }
예제 #2
0
        /// <summary>
        /// Creates limit
        /// </summary>
        private void CreateLim()
        {
            if (!(category is IDirectProductCategory))
            {
                throw new CategoryException(CategoryException.DirectProductNotSupported);
            }
            if (!(category is IEqualizerCategory))
            {
                throw new CategoryException(CategoryException.EqualizerNotSupported);
            }
            IDirectProductCategory          productCategory = category as IDirectProductCategory;
            IList <IAdvancedCategoryArrow>  firstArrows     = new List <IAdvancedCategoryArrow>();
            IAdvancedCategoryObject         firstProduct    = productCategory.GetDirectProduct(objects, firstArrows);
            IList <IAdvancedCategoryObject> endObjects      = new List <IAdvancedCategoryObject>();

            foreach (CategoryObjectPair o in arrows.Keys)
            {
                IAdvancedCategoryArrow a = arrows[o] as IAdvancedCategoryArrow;
                endObjects.Add(a.Target as IAdvancedCategoryObject);
            }
            IList <IAdvancedCategoryArrow> secondArrows  = new List <IAdvancedCategoryArrow>();
            IAdvancedCategoryObject        secondProduct = productCategory.GetDirectProduct(endObjects, secondArrows);

            limIdArrows = new List <IAdvancedCategoryArrow>();
            foreach (IAdvancedCategoryArrow tar in secondArrows)
            {
                IAdvancedCategoryObject t = tar.Target as IAdvancedCategoryObject;
                foreach (IAdvancedCategoryArrow proj in firstArrows)
                {
                    if (proj.Target == t)
                    {
                        limIdArrows.Add(proj);
                        break;
                    }
                }
            }
            limIdArrow    = productCategory.GetArrowToDirectProduct(firstProduct, secondProduct, limIdArrows);
            limFuncArrows = new List <IAdvancedCategoryArrow>();
            foreach (CategoryObjectPair o in arrows.Keys)
            {
                IAdvancedCategoryArrow tar = this[o];
                foreach (IAdvancedCategoryArrow proj in firstArrows)
                {
                    if (proj.Target == tar.Source)
                    {
                        IAdvancedCategoryArrow ar = tar.Compose(category, proj);
                        limFuncArrows.Add(ar);
                        break;
                    }
                }
            }
            limFuncArrow = productCategory.GetArrowToDirectProduct(firstProduct, secondProduct, limFuncArrows);
            IEqualizerCategory equalizerCategory = category as IEqualizerCategory;

            limArrow  = equalizerCategory.GetEqualizer(limIdArrow, limFuncArrow);
            lim       = limArrow.Source as IAdvancedCategoryObject;
            limArrows = new Dictionary <IAdvancedCategoryObject, IAdvancedCategoryArrow>();
            foreach (IAdvancedCategoryArrow proj in firstArrows)
            {
                IAdvancedCategoryObject t  = proj.Target as IAdvancedCategoryObject;
                IAdvancedCategoryArrow  ar = proj.Compose(category, limArrow);
                limArrows[t] = ar;
            }
        }