Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tp6 Flood
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
EL GAOUAL Zaid
Tp6 Flood
Commits
665d125f
Commit
665d125f
authored
2 years ago
by
EL GAOUAL Zaid
Browse files
Options
Downloads
Patches
Plain Diff
Squared Cell & ArrayGrid
parent
f1b2f519
No related branches found
No related tags found
No related merge requests found
Pipeline
#10237
failed
2 years ago
Stage: build
Stage: test
Stage: dast
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+2
-2
2 additions, 2 deletions
README.md
app/src/main/java/model/ArrayGrid.java
+30
-0
30 additions, 0 deletions
app/src/main/java/model/ArrayGrid.java
app/src/main/java/model/SquareCell.java
+19
-6
19 additions, 6 deletions
app/src/main/java/model/SquareCell.java
with
51 additions
and
8 deletions
README.md
+
2
−
2
View file @
665d125f
...
...
@@ -6,5 +6,5 @@ Il s'agit d'implémenter une version du jeu "inondation" (voir par exemple [ici]
## Membre du projet
-
NOM, prénom
-
NOM, prénom
-
EL Gaoual, Zaid e21221636
-
BELKHALIFA, Mohamed Amine
This diff is collapsed.
Click to expand it.
app/src/main/java/model/ArrayGrid.java
0 → 100644
+
30
−
0
View file @
665d125f
package
model
;
public
class
ArrayGrid
implements
Grid
{
public
Cell
[][]
cells
;
public
void
arrayGrid
(
int
numberOfRows
,
int
numberOfColumns
)
{
if
(
numberOfRows
<=
0
||
numberOfColumns
<=
0
)
throw
new
IllegalArgumentException
(
"Le nombre de lignes ou de colonnes ne peut pas être nul ou négatif."
);
Cell
[][]
cells
=
new
Cell
[
numberOfRows
][
numberOfColumns
];
for
(
Cell
[]
column
:
cells
)
{
for
(
Cell
cell
:
column
)
{
cell
=
new
SquareCell
();
}
}
}
@Override
public
Cell
getCell
(
int
row
,
int
column
)
{
return
cells
[
row
][
column
];
}
@Override
public
int
getNumberOfRows
()
{
return
cells
.
length
;
}
@Override
public
int
getNumberOfColumns
()
{
return
cells
[
0
].
length
;
}
}
This diff is collapsed.
Click to expand it.
app/src/main/java/model/SquareCell.java
+
19
−
6
View file @
665d125f
...
...
@@ -6,8 +6,24 @@ import java.util.Iterator;
import
java.util.List
;
public
class
SquareCell
extends
AbstractCell
{
public
List
<
Cell
>
neighbours
;
public
SquareCell
()
{
Color
DEFAULT_CELL_COLOR
;
List
<
Cell
>
neighbours
;
}
public
SquareCell
(
Color
color
)
{
this
.
setColor
(
color
);
List
<
Cell
>
neighbours
;
}
public
SquareCell
(
Color
color
,
List
<
Cell
>
neighbours
)
{
this
.
setColor
(
color
);
this
.
setNeighbours
(
neighbours
);
}
List
<
Cell
>
neighbours
;
/**
...
...
@@ -16,10 +32,7 @@ public class SquareCell extends AbstractCell{
* @return the list of cell that are neighbours of this{@code Cell}.
*/
@Override
public
List
<
Cell
>
getNeighbours
()
{
return
null
;
}
public
List
<
Cell
>
getNeighbours
()
{
return
this
.
neighbours
;}
/**
* Update the list of neighbours of this {@code Cell}.
*
...
...
@@ -28,7 +41,7 @@ public class SquareCell extends AbstractCell{
*/
@Override
public
void
setNeighbours
(
List
<
Cell
>
cells
)
{
this
.
neighbours
=
cells
;
}
...
...
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