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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EL GHAOUTI Aymane
flooding-template_EL-GHAOUTI_AYMANE
Commits
1abc5c20
Commit
1abc5c20
authored
2 years ago
by
dragapsy
Browse files
Options
Downloads
Patches
Plain Diff
Corection de la methode Color nextColor(Cell cell).
parent
0a5c4ac6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/src/main/java/model/SquareCell.java
+1
-1
1 addition, 1 deletion
app/src/main/java/model/SquareCell.java
app/src/main/java/model/UniformColorGenerator.java
+13
-9
13 additions, 9 deletions
app/src/main/java/model/UniformColorGenerator.java
with
14 additions
and
10 deletions
app/src/main/java/model/SquareCell.java
+
1
−
1
View file @
1abc5c20
...
...
@@ -23,7 +23,7 @@ public class SquareCell extends AbstractCell{
}
public
SquareCell
(
Color
color
,
List
<
Cell
>
neighbours
){
SquareCell
Cell
=
new
SquareCell
(
color
);
setNeighbours
(
neighbours
);
setNeighbours
(
neighbours
);
}
...
...
This diff is collapsed.
Click to expand it.
app/src/main/java/model/UniformColorGenerator.java
+
13
−
9
View file @
1abc5c20
...
...
@@ -6,20 +6,24 @@ import java.util.Random;
public
class
UniformColorGenerator
implements
ColorGenerator
{
private
Color
color
;
//code of color generator found on stackOverFlow;
// link : https://stackoverflow.com/questions/4246351/creating-random-colour-in-java
// but the color constructor with 3 parameter is not public, so I checked in the documentation of Color, and
// I found that there is a constructor with 4 parameter that is public since java 8;
// Link of the doc : https://docs.oracle.com/javase/8/javafx/api/javafx/scene/paint/Color.html
@Override
public
Color
nextColor
(
Cell
cell
)
{
Random
rand
=
new
Random
();
double
red
=
rand
.
nextFloat
();
double
green
=
rand
.
nextFloat
();
double
blue
=
rand
.
nextFloat
();
double
opacity
=
rand
.
nextFloat
();
Color
randomColor
=
new
Color
(
red
,
green
,
blue
,
opacity
);
cell
.
setColor
(
randomColor
);
return
randomColor
;
public
Color
nextColor
(
Cell
cell
)
{
// Random rand = new Random();
// double red = rand.nextFloat();
// double green = rand.nextFloat();
// double blue = rand.nextFloat();
// double opacity=rand.nextFloat();
// Color randomColor = new Color(red, green, blue,opacity);
// cell.setColor(randomColor);
// return randomColor;
return
this
.
color
;
}
}
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