コード例 #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;
        }
コード例 #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;
 }
コード例 #3
0
 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);
 }
コード例 #4
0
 public void SetNaturalTransformation()
 {
     Type = MorphismType.NaturalTransformation;
 }
コード例 #5
0
 public Morphism(MathObject math, string source, string target, MorphismType type)
     : this(math, source, target, type, Array.Empty <Morphism>())
 {
 }
コード例 #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)
 {
 }
コード例 #7
0
 public Morphism(MathObject math, MathObject source, MathObject target, MorphismType type, int defLine)
     : this(math, source, target, type, Array.Empty <Morphism>())
 {
     _defLine = defLine;
 }
コード例 #8
0
 private Morphism ToMorphismHelp(string name, string source, string target, MorphismType type)
 => new Morphism(name, source, target, type, -1);