Example #1
0
        public Morphism(MathObject math, MathObject source, MathObject target, MorphismType type, IEnumerable <Morphism> defMorphismList)
        {
            Name   = math;
            Source = source;
            Target = target;

            if ((type == MorphismType.Functor || type == MorphismType.OneMorphism) &&
                (source.IsCategory() || target.IsCategory()))
            {
                if (source.Contains(@"\times"))
                {
                    Type = MorphismType.Bifunctor;
                }
                else if (IsContravariant(source, target))
                {
                    Type = MorphismType.ContravariantFunctor;
                }
                else
                {
                    Type = MorphismType.Functor;
                }
            }
            else
            {
                Type = type;
            }

            _defMorphismList = new ReadOnlyCollection <Morphism>(defMorphismList.ToList());
            _defLine         = -1;
        }
Example #2
0
 public Morphism(string name, string source, string target, MorphismType type, int defLine)
     : this(new MathObjectFactory(name).CreateSingle(),
            new MathObjectFactory(source).CreateSingle(),
            new MathObjectFactory(target).CreateSingle(),
            type, Array.Empty <Morphism>())
 {
     _defLine = defLine;
 }
 public static void TestMorphism(this Morphism m, string name, string source, string target, MorphismType type)
 {
     m.Name.ToTokenString().TestString(name);
     m.Source.ToTokenString().TestString(source);
     m.Target.ToTokenString().TestString(target);
     m.Type.Is(type);
 }
Example #4
0
 public void SetNaturalTransformation()
 {
     Type = MorphismType.NaturalTransformation;
 }
Example #5
0
 public Morphism(MathObject math, string source, string target, MorphismType type)
     : this(math, source, target, type, Array.Empty <Morphism>())
 {
 }
Example #6
0
 public Morphism(MathObject math, string source, string target, MorphismType type, IEnumerable <Morphism> defMorphismList)
     : this(math, new MathObjectFactory(source).CreateSingle(), new MathObjectFactory(target).CreateSingle(), type, defMorphismList)
 {
 }
Example #7
0
 public Morphism(MathObject math, MathObject source, MathObject target, MorphismType type, int defLine)
     : this(math, source, target, type, Array.Empty <Morphism>())
 {
     _defLine = defLine;
 }
 private Morphism ToMorphismHelp(string name, string source, string target, MorphismType type)
 => new Morphism(name, source, target, type, -1);