-
Notifications
You must be signed in to change notification settings - Fork 3
kth/계산기 1차 코드 리뷰 #2
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
base: kth/main
Are you sure you want to change the base?
Changes from 1 commit
3ff5220
3d40f99
a2d84a9
adee2c4
3dace13
0d743bd
f1db66f
d6b26c0
250674d
4dfb3b9
7ab770b
fd48306
a79039f
164cf9a
b528194
5d05bb9
ad1ca5d
5b6986c
00a52a0
ecd0d2d
7beba5c
7551509
3557acc
f0b3c9f
527efac
06ab0ee
d14b8bd
8066eb2
1ea1141
90746b5
01f2074
28c4398
da609f1
93f245e
2905ce4
c9bcc79
f755333
4e2831c
eedc44c
57f95cf
476aed8
8048649
bddb95f
fb2677d
cf0898b
e3049bb
7cc00b6
0b70d47
f7565d3
a26b217
58a2f06
0e4b06c
71928f3
0b728d3
2410415
2256b3e
a157b8b
74c7172
53e1a08
b7cb3ab
5dc13a4
503e594
1c27980
05b3b99
35c6e77
5d9a319
5f2e78e
a1fa676
87dcb6b
7107d5c
123488d
2c23bcb
5ae1ab2
5dd678d
308f1c7
cfddb59
a5bfd08
8152b7f
f399249
79a839f
1cc812a
7d1273a
18d1e37
0d0ade7
dc51378
8eadf1b
6a09420
d06b78e
0a02174
6ce8564
e8baa79
d2292a4
f0e3eda
fd87dbc
48b595b
c106797
6be3443
b2d4465
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| package util; | ||
|
|
||
| import java.util.regex.Matcher; | ||
| import java.util.regex.Pattern; | ||
|
|
||
| public class PatternValidator { | ||
|
|
||
| private static final Pattern EXPRESSIONREGEX = Pattern.compile("^\\d+(?: \\+ \\d+| - \\d+| \\* \\d+| \\/ \\d+)*$"); | ||
|
|
||
| private static final Pattern OPTIONREGEX = Pattern.compile("^[12]+$"); | ||
|
|
||
| private static final Pattern OPERATORREGEX = Pattern.compile("[\\+\\-\\*/]"); | ||
|
|
||
| public static boolean checkExpressionValue(String expression) { | ||
| Matcher matcher = EXPRESSIONREGEX.matcher(expression); | ||
| if (!matcher.matches()) { | ||
| throw new IllegalArgumentException("잘못된 식 입력입니다."); | ||
|
||
| } | ||
| return true; | ||
| } | ||
|
|
||
|
|
||
| public static boolean checkSelectValue(String select) { | ||
| Matcher matcher = OPTIONREGEX.matcher(select); | ||
| if (!matcher.matches()) { | ||
| throw new IllegalArgumentException("잘못된 옵션 선택입니다"); | ||
|
||
| } | ||
| return true; | ||
| } | ||
|
|
||
| public static boolean checkOperatorValue(String operator){ | ||
| Matcher matcher = OPERATORREGEX.matcher(operator); | ||
| if (!matcher.matches()) { | ||
| return false; | ||
|
||
| } | ||
| return true; | ||
| } | ||
|
|
||
| } | ||
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
지금 보니 Calculator에 compute기능이 있네요.
compute 내부 메서드를 잘 살펴보시겠어요? 객체에게 메세지를 보내는 것 같나요..?
해당 객체들은 메서드가 호출되어 스택이 올라갈 떄마다 힙영역에 매번 새로운 객체가 저장하겠네요.
이러한 방법이 좋은 방법인 것 같나요?
태훈님 지금 피드백해드리는데 피드백 해주는 것만 보지마시고 저번에 말씀드렸던 것 처럼 태훈님은 전체적인 코드를 다 손봐야해요.
객체지향적으로 구조를 다시 잡으시죠