Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
flooding-template
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
NGUYEN Thi hang
flooding-template
Commits
40e52b8e
Commit
40e52b8e
authored
2 years ago
by
NGUYEN Thi hang
Browse files
Options
Downloads
Patches
Plain Diff
THN
parent
2640a150
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/src/main/java/model/ArrayGrid.java
+1
-1
1 addition, 1 deletion
app/src/main/java/model/ArrayGrid.java
app/src/main/java/model/CellGridIterator.java
+11
-15
11 additions, 15 deletions
app/src/main/java/model/CellGridIterator.java
with
12 additions
and
16 deletions
app/src/main/java/model/ArrayGrid.java
+
1
−
1
View file @
40e52b8e
...
@@ -33,6 +33,6 @@ public class ArrayGrid implements Grid{
...
@@ -33,6 +33,6 @@ public class ArrayGrid implements Grid{
}
}
}
}
public
Iterator
<
Cell
>
iterator
(){
public
Iterator
<
Cell
>
iterator
(){
return
new
CellGridIterator
();
return
new
CellGridIterator
(
this
);
}
}
}
}
This diff is collapsed.
Click to expand it.
app/src/main/java/model/CellGridIterator.java
+
11
−
15
View file @
40e52b8e
...
@@ -2,29 +2,25 @@ package model;
...
@@ -2,29 +2,25 @@ package model;
public
class
CellGridIterator
implements
Iterator
<
Cell
>{
public
class
CellGridIterator
implements
Iterator
<
Cell
>{
ArrayGrid
grid
;
ArrayGrid
grid
;
Iterator
<
Cell
>
it
=
grid
.
iterator
();
int
indixRow
;
int
indixRow
;
int
indixColum
;
int
indixColum
;
public
CellGridIterator
(
ArrayGrid
grid
)
{
public
CellGridIterator
(
ArrayGrid
grid
)
{
this
.
grid
=
grid
;
this
.
grid
=
grid
;
this
.
indixColum
=
0
;
this
.
indixRow
=
0
;
}
}
public
SquareCell
next
()
{
public
Cell
next
()
{
int
i
=
0
;
final
Cell
result
=
grid
.
getCell
(
indixRow
,
indixColum
);
while
(
i
<
grid
.
getNumberOfRows
())
{
indixColum
=
(
indixColum
+
1
)
%
grid
.
getNumberOfColumns
();
if
(
indixColum
==
0
){
while
(
it
.
hasNext
())
{
indixRow
++;
return
it
.
next
();
}
i
++;
}
}
}
return
result
;
public
boolean
hasNext
(
){
int
n
;
if
(
n
>=
grid
.
getNumberOfColumns
()||
n
>=
grid
.
getNumberOfRows
())
return
false
;
}
}
public
boolean
hasNext
(){
return
this
.
indixColum
<
this
.
grid
.
getNumberOfColumns
()
&&
indixRow
<
this
.
grid
.
getNumberOfRows
();
}
}
}
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