internal override EquationParserState HandleClosingBracketOverride(Bracket bracket, int charIndex) { myCoefficient *= bracket.BracketMultiplier; var bracketYieldedCoefficients = bracket.CoefficientOrder != CoefficientsLine.Count; if (bracketYieldedCoefficients) { AddVariable(); return(new AwaitSummandState(VariableAggregator, BracketsLine, CoefficientsLine)); } if (!IsValid()) { throw new EquationParsingException(Resources.IsNotEquationException); } return(new AwaitRankAfterClosingBracketState( VariableAggregator, BracketsLine, CoefficientsLine, bracket, string.Concat(myVariableNameSet), myCoefficient)); }
internal override EquationParserState HandleClosingBracketOverride(Bracket bracket, int charIndex) { if (bracket.CoefficientOrder == CoefficientsLine.Count) { throw new EquationParsingException(string.Format(Resources.MeaninglessClosingBracketAtIndex_Format, charIndex)); } return(this); }
internal override EquationParserState HandleClosingBracketOverride(Bracket bracket, int charIndex) { var bracketYieldsConstants = CoefficientsLine .Skip(bracket.CoefficientOrder) .All(_ => _.Type == CoefficientType.Constant); return(bracketYieldsConstants ? new CoefficientYieldedFromBracketState(VariableAggregator, BracketsLine, CoefficientsLine, bracket.CoefficientOrder) : (EquationParserState) new AwaitSummandState(VariableAggregator, BracketsLine, CoefficientsLine)); }
public AwaitRankAfterClosingBracketState( [NotNull] Dictionary <string, VariableDescriptor> variableAggregator, [NotNull] Stack <Bracket> bracketsLine, [NotNull] List <VariableCoefficient> coefficientsLine, Bracket closingBracket, string variableName, double coefficient) : base(variableAggregator, bracketsLine, coefficientsLine) { myClosingBracket = closingBracket; myVariableName = variableName; myCoefficient = coefficient; }
internal override EquationParserState HandleClosingBracketOverride(Bracket bracket, int charIndex) { // fixing variable coefficient, because it is not added yet myCoefficient *= bracket.BracketMultiplier; AddVariable(); var bracketYieldsConstants = CoefficientsLine .Skip(bracket.CoefficientOrder) .All(_ => _.Type == CoefficientType.Constant); return(bracketYieldsConstants ? (EquationParserState) new CoefficientYieldedFromBracketState(VariableAggregator, BracketsLine, CoefficientsLine, bracket.CoefficientOrder) : new AwaitSummandState(VariableAggregator, BracketsLine, CoefficientsLine)); }
internal override EquationParserState HandleClosingBracketOverride(Bracket bracket, int charIndex) { var correctedCoefficient = myCoefficient * bracket.BracketMultiplier; var bracketYieldedCoefficients = bracket.CoefficientOrder != CoefficientsLine.Count; if (bracketYieldedCoefficients) { AddVariable(); return(new AwaitSummandState(VariableAggregator, BracketsLine, CoefficientsLine)); } return(new AwaitRankAfterClosingBracketState( VariableAggregator, BracketsLine, CoefficientsLine, bracket, myVariableName, correctedCoefficient)); }
internal abstract EquationParserState HandleClosingBracketOverride(Bracket bracket, int charIndex);
internal override EquationParserState HandleClosingBracketOverride(Bracket bracket, int charIndex) { return(myDecorated.HandleClosingBracketOverride(bracket, charIndex)); }