Skip to content

Routers - #11

Open
Palezehvat wants to merge 11 commits into
masterfrom
Routers
Open

Palezehvat wants to merge 11 commits into
masterfrom
Routers

Conversation

@Palezehvat

Copy link
Copy Markdown
Owner

Дз по роутерам

@yurii-litvinov yurii-litvinov left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно было обойтись в три раза меньшим количеством строк кода. И оооочень неаккуратно.

Comment thread Routers/Routers/Graph.cs Outdated
/// Returns graph size
/// </summary>
/// <returns>Graph size</returns>
/// <exception cref="NullPointerException">If graph null throw exception</exception>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Так он не null, а пустой :)

Comment thread Routers/Routers/Graph.cs Outdated
{
if (IsEmpty())
{
throw new NullPointerException();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут та же проблема, я как пользователь хочу знать, в чём я неправ и как это исправить. NullPointerException мне никак в этом не поможет, тем более что в C# нет pointer-ов.

Comment thread Routers/Routers/Graph.cs Outdated
{
throw new NullPointerException();
}
return GraphByList.sizeGraph;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nullability недоволен, надо поправить

Comment thread Routers/Routers/Graph.cs Outdated
/// </summary>
/// <returns>Graph size</returns>
/// <exception cref="NullPointerException">If graph null throw exception</exception>
public int ReturnSizeGraph()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это лучше было сделать свойством, причём просто Size

Comment thread Routers/Routers/Graph.cs Outdated
/// <param name="sizeWay">Path Size</param>
public void AddArcs(int fromVertex, int toVertex, int sizeWay)
{
if(GraphByList == null)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if(GraphByList == null)
if (GraphByList == null)

Comment thread Routers/Routers/Routers.cs Outdated
/// <exception cref="InvalidFileException">Throws an exception if the entry in the file is uncorrected</exception>
public bool WorkWithFile(string filePath, string fileAfter)
{
var file = new StreamReader(filePath);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var file = new StreamReader(filePath);
using var file = new StreamReader(filePath);

Comment thread Routers/Routers/Routers.cs Outdated
++i;
while (Char.IsDigit(line[i]))
{
mainVertex = mainVertex * 10 + line[i] - 48;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Используйте int.TryParse

Comment thread Routers/TestsForGraph/TestsForGraph.cs Outdated
using Routers;
public class Tests
{
Graph graph;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Graph graph;
private Graph graph;

Comment thread Routers/TestsForGraph/TestsForGraph.cs Outdated
Comment on lines +3 to +4
using Routers;
public class Tests

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
using Routers;
public class Tests
using Routers;
public class Tests

Comment thread Routers/TestsForGraph/TestsForGraph.cs Outdated
private static IEnumerable<TestCaseData> GraphForTest
=> new TestCaseData[]
{
new TestCaseData(new Graph()),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants