Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
flooding-template_EL-GHAOUTI_AYMANE
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EL GHAOUTI Aymane
flooding-template_EL-GHAOUTI_AYMANE
Commits
68c45383
Commit
68c45383
authored
Nov 15, 2022
by
dragapsy
Browse files
Options
Downloads
Patches
Plain Diff
MAJ
parent
c1e580c0
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
README.md
+1
-1
1 addition, 1 deletion
README.md
app/src/main/java/model/SquareCell.java
+30
-2
30 additions, 2 deletions
app/src/main/java/model/SquareCell.java
with
31 additions
and
3 deletions
README.md
+
1
−
1
View file @
68c45383
This diff is collapsed.
Click to expand it.
app/src/main/java/model/SquareCell.java
+
30
−
2
View file @
68c45383
...
...
@@ -2,6 +2,8 @@ package model;
import
javafx.scene.paint.Color
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Iterator
;
import
java.util.List
;
...
...
@@ -9,6 +11,21 @@ public class SquareCell extends AbstractCell{
List
<
Cell
>
neighbours
;
public
SquareCell
(){
setColor
(
AbstractCell
.
DEFAULT_CELL_COLOR
);
setNeighbours
(
null
);
}
public
SquareCell
(
Color
color
){
setColor
(
color
);
setNeighbours
(
null
);
}
public
SquareCell
(
Color
color
,
List
<
Cell
>
neighbours
){
SquareCell
Cell
=
new
SquareCell
(
color
);
setNeighbours
(
neighbours
);
}
/**
* A cell is placed somewhere on a grid. Its neighbours thus depend on the underlying grid.
...
...
@@ -17,7 +34,7 @@ public class SquareCell extends AbstractCell{
*/
@Override
public
List
<
Cell
>
getNeighbours
()
{
return
n
ull
;
return
n
eighbours
;
}
/**
...
...
@@ -28,6 +45,17 @@ public class SquareCell extends AbstractCell{
*/
@Override
public
void
setNeighbours
(
List
<
Cell
>
cells
)
{
if
(
cells
==
null
){
neighbours
=
new
ArrayList
<>();
}
else
{
neighbours
=
new
ArrayList
<>();
for
(
Cell
value:
cells
)
{
neighbours
.
add
(
value
);
}
}
}
...
...
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