Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
javafx-template
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Njål Brynhildarson Telstø
javafx-template
Commits
4cf4bcfb
Commit
4cf4bcfb
authored
3 years ago
by
njal3001
Browse files
Options
Downloads
Patches
Plain Diff
Closes (#1)
parent
84bd1ee3
Branches
error-fix-1
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
javafx-template/src/main/java/app/Calc.java
+3
-2
3 additions, 2 deletions
javafx-template/src/main/java/app/Calc.java
javafx-template/src/test/java/app/CalcTest.java
+2
-2
2 additions, 2 deletions
javafx-template/src/test/java/app/CalcTest.java
with
5 additions
and
4 deletions
javafx-template/src/main/java/app/Calc.java
+
3
−
2
View file @
4cf4bcfb
...
...
@@ -38,10 +38,11 @@ public class Calc {
* @throws IllegalArgumentException if n is larger than the operand count
*/
public
double
peekOperand
(
int
n
)
{
if
(
n
>
getOperandCount
())
{
int
index
=
getOperandCount
()
-
n
-
1
;
if
(
index
>=
getOperandCount
()
||
index
<
0
)
{
throw
new
IllegalArgumentException
(
"Cannot peek at position "
+
n
+
" when the operand count is "
+
getOperandCount
());
}
return
operandStack
.
get
(
getOperandCount
()
-
n
-
1
);
return
operandStack
.
get
(
index
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
javafx-template/src/test/java/app/CalcTest.java
+
2
−
2
View file @
4cf4bcfb
...
...
@@ -87,9 +87,9 @@ public class CalcTest {
public
void
testSwap
()
{
Calc
calc
=
new
Calc
(
1.0
,
3.14
);
calc
.
swap
();
checkCalc
(
calc
,
3.14
,
1.0
);
calc
.
swap
();
checkCalc
(
calc
,
1.0
,
3.14
);
calc
.
swap
();
checkCalc
(
calc
,
3.14
,
1.0
);
}
@Test
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment