-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNoSolutionException.cs
More file actions
24 lines (21 loc) · 956 Bytes
/
Copy pathNoSolutionException.cs
File metadata and controls
24 lines (21 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using System;
using System.Text;
namespace GaussAlgorithm
{
public class NoSolutionException : Exception
{
public NoSolutionException(string message) : base(message)
{ }
public NoSolutionException(double[][] initialMatrix, double[] freeMembers, double[][] matrixAfterSolve)
: base(GetMessage(initialMatrix, freeMembers, matrixAfterSolve))
{ }
private static string GetMessage(double[][] sourceMatrix, double[] freeMembers, double[][] solvedMatrix)
{
var builder = new StringBuilder();
builder.Append("Initial matrix:" + Environment.NewLine + sourceMatrix.FormatMatrix() + Environment.NewLine);
builder.Append("Free members: [" + string.Join(", ", freeMembers) + "]" + Environment.NewLine);
builder.Append("Matrix after Solve:" + Environment.NewLine + solvedMatrix.FormatMatrix());
return builder.ToString();
}
}
}