-
Notifications
You must be signed in to change notification settings - Fork 10
Task 8 Gerasimik Pavel #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
PahaKoha
wants to merge
5
commits into
mak-42:master
Choose a base branch
from
PahaKoha:extraPullRequests
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
86f29be
Task 8 Gerasimik Pavel
PahaKoha 19d78e5
Returned the test scripts to their original state
PahaKoha 2e29387
Corrected the code taking into account the 'Single responsibility pri…
PahaKoha 19bbe74
PositionCountException and CheckPositionCount classes fix
PahaKoha 39f130d
final commit 100% work hehe
PahaKoha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
|
|
||
| target/ | ||
| .mvn/wrapper/maven-wrapper.jar | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/main/java/croc/education/ws2023spb/knightsmove/CheckerPositionCount.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package croc.education.ws2023spb.knightsmove; | ||
|
|
||
| public class CheckerPositionCount { | ||
| public static boolean check (String[] str) { | ||
| if (str.length >= 2) { | ||
| return true; | ||
| } else { | ||
| throw new PositionCountException(); | ||
|
mak-42 marked this conversation as resolved.
|
||
| } | ||
| } | ||
| } | ||
27 changes: 27 additions & 0 deletions
27
src/main/java/croc/education/ws2023spb/knightsmove/ChessPositionImpl.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| package croc.education.ws2023spb.knightsmove; | ||
|
|
||
| public class ChessPositionImpl implements ChessPosition{ | ||
| private int x; | ||
| private int y; | ||
|
|
||
| public ChessPositionImpl(int x, int y) { | ||
| this.x = x; | ||
| this.y = y; | ||
| } | ||
| @Override | ||
| public int x() { | ||
| return x; | ||
| } | ||
|
|
||
| @Override | ||
| public int y() { | ||
| return y; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| char column = (char) ('a' + x); | ||
| char row = (char) ('1' + y); | ||
| return column + String.valueOf(row); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/main/java/croc/education/ws2023spb/knightsmove/IllegalPositionException.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package croc.education.ws2023spb.knightsmove; | ||
|
|
||
| public class IllegalPositionException extends RuntimeException{ | ||
| private final String position; | ||
|
|
||
| public IllegalPositionException(String position) { | ||
| this.position = position; | ||
| } | ||
|
|
||
| @Override | ||
| public String getMessage() { | ||
| return "Позиции " + position + " не существует, пожалуйста, проверьте корректность написания данной позиции."; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/main/java/croc/education/ws2023spb/knightsmove/PositionCountException.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package croc.education.ws2023spb.knightsmove; | ||
|
|
||
| public class PositionCountException extends RuntimeException{ | ||
| @Override | ||
| public String getMessage() { | ||
| return "Пожалуйста, укажите как минимум две позиции"; | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.