public override bool IsSameType(MathObject other, IDictionary <string, MathObject> parameters) { var x = this.ToString(); if (this.IsVariable()) { if (x.Length == 3 && x[2] == '?') { return(IsSameTypeMain(other, parameters, x.Substring(0, 2))); } else { return(IsSameTypeMain(other, parameters, x)); } } else { return(other is MathToken && this.Main.Equals(other.Main)); } }
/// <summary> /// MathObjectが同じ「型」であるかを調べる /// </summary> /// <param name="other">#1, #2, …, #9を含まないMathObject</param> /// <param name="parameters">#1, #2, …, #9に対応するパラメーターを取得し格納する辞書</param> /// <returns>同じ型ならtrue</returns> public abstract bool IsSameType(MathObject other, IDictionary <string, MathObject> parameters);
/// <summary> /// 指定したMathObjectで二つに分割する(全てのパターンを返す)(添え字がある場合は何も返さない) /// </summary> /// <param name="center">分割で使用するMathObject</param> /// <returns>left: 左のMathObject center: 指定したMathObject right: 右のMathObject</returns> public abstract IEnumerable <(MathObject left, MathObject center, MathObject right)> Divide(MathObject center);
/// <summary> /// 添え字を付ける /// </summary> /// <param name="supOrSub">^ もしくは _ を表すToken</param> /// <param name="left">左側の括弧となるToken</param> /// <param name="math">添え字となるMathObject</param> /// <param name="right">右側の括弧となるToken</param> /// <returns>付けた後のMathSequence</returns> public abstract MathSequence SetScript(Token supOrSub, Token left, MathObject math, Token right);
/// <summary> /// コンストラクタ /// </summary> /// <param name="nodeName">対象のnode name</param> /// <param name="mathText">対象を表す数式</param> private TikZNode(string nodeName, MathObject math) { NodeName = nodeName; MathObject = math; }
/// <summary> /// コンストラクタ /// </summary> /// <param name="name">射の名前を表すSequence</param> /// <param name="source">domainのnode name</param> /// <param name="target">codomainのnode name</param> private TikZArrow(MathObject name, string source, string target) { MathObject = name; SourceNodeName = source; TargetNodeName = target; }
public override MathSequence SetScript(Token supOrSub, Token left, MathObject math, Token right) { return(new MathSequence(this, supOrSub, left, math, right)); }
public Functor(MathObject name, MathObject functor) { Name = name; _functor = functor; }
public override IEnumerable <(MathObject left, MathObject center, MathObject right)> Divide(MathObject center) { yield break; }
public Morphism(MathObject math, string source, string target, MorphismType type) : this(math, source, target, type, Array.Empty <Morphism>()) { }
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) { }
public Morphism(MathObject math, MathObject source, MathObject target, MorphismType type, int defLine) : this(math, source, target, type, Array.Empty <Morphism>()) { _defLine = defLine; }