private MathSequence(MathToken token) { List = new ReadOnlyCollection <MathObject>(new[] { token }); Main = token.ToTokenString(); Separator = ""; _toTokenString = Main; _toString = _toTokenString.ToString(); OriginalText = token.OriginalText; }
public MathSequence(MathToken token, Token leftBracket, Token rightBracket) : this(token) { LeftBracket = leftBracket; RightBracket = rightBracket; _toTokenString = ConstructorHelperBracket(leftBracket, Main, rightBracket); _toString = _toTokenString.ToString(); OriginalText = _toTokenString.ToOriginalString().Trim(); }
public MathSequence(MathToken token, Token supOrSub, Token left, MathObject math, Token right) : this(token) { if (supOrSub.Value == "^") { Sup = math; _supFirst = true; } else { Sub = math; } _toTokenString = ConstructorHelperSupSub(_toTokenString, supOrSub, left, math.ToTokenString(), right); _toString = _toTokenString.ToString(); OriginalText = _toTokenString.ToOriginalString().Trim(); }
private MathSequence(MathSequence seq, Token supOrSub, Token left, MathObject math, Token right) : this(seq) { if (supOrSub.Value == "^") { Sup = math; if (Sub == null) { _supFirst = true; } } else { Sub = math; } _toTokenString = ConstructorHelperSupSub(_toTokenString, supOrSub, left, math.ToTokenString(), right); _toString = _toTokenString.ToString(); OriginalText = _toTokenString.ToOriginalString().Trim(); }
private MathSequence(MathSequence seq, IList <MathObject> list, MathObject?sup, MathObject?sub) : this(seq) { if (list.Count == 0) { throw new InvalidOperationException($"{nameof(list)}が空です。"); } List = new ReadOnlyCollection <MathObject>(list); Main = CreateMainTokenString(List, seq.Separator); _toTokenString = ConstructorHelperBracket(seq.LeftBracket, Main, seq.RightBracket); Sup = sup; Sub = sub; if (seq._supFirst) { if (sup != null) { _toTokenString = ConstructorHelperSupSub(_toTokenString, Token.Circumflex, sup.ToTokenString()); } if (sub != null) { _toTokenString = ConstructorHelperSupSub(_toTokenString, Token.LowLine, sub.ToTokenString()); } } else { if (sub != null) { _toTokenString = ConstructorHelperSupSub(_toTokenString, Token.LowLine, sub.ToTokenString()); } if (sup != null) { _toTokenString = ConstructorHelperSupSub(_toTokenString, Token.Circumflex, sup.ToTokenString()); } } _toString = _toTokenString.ToString(); OriginalText = _toTokenString.ToOriginalString().Trim(); }