Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Prog2Aix-tp3
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
DAS Shantanu
Prog2Aix-tp3
Merge requests
!1
Update Cell.java
Code
Review changes
Check out branch
Open in Workspace
Download
Patches
Plain diff
Open
Update Cell.java
d19027596/tp3:patch-2
into
master
Overview
0
Commits
1
Pipelines
0
Changes
1
Open
DURIEZ Kilian
requested to merge
d19027596/tp3:patch-2
into
master
4 years ago
Overview
0
Commits
1
Pipelines
0
Changes
1
Expand
Tp 3 fini
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
de293d83
1 commit,
4 years ago
1 file
+
28
−
20
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Cell.java
+
28
−
20
Options
@@ -4,11 +4,19 @@
public
class
Cell
{
private
boolean
isAlive
;
private
String
color
=
"Red"
;
public
void
setColor
(
String
hisColor
)
{
color
=
hisColor
;
}
public
String
getColor
()
{
return
color
;
}
public
Cell
(){
this
.
isAlive
=
false
;
this
.
isAlive
=
false
;
}
/**
* Determines whether this {@link Cell} is alive or not.
*
@@ -36,7 +44,7 @@ public class Cell {
*/
public
void
setAlive
()
{
this
.
isAlive
=
true
;
this
.
isAlive
=
true
;
}
/**
@@ -46,7 +54,7 @@ public class Cell {
*/
public
void
setDead
()
{
this
.
isAlive
=
false
;
this
.
isAlive
=
false
;
}
@@ -55,24 +63,24 @@ public class Cell {
*/
public
void
toggleState
()
{
if
(
this
.
isAlive
)
this
.
isAlive
=
false
;
else
this
.
isAlive
=
true
;
if
(
this
.
isAlive
)
this
.
isAlive
=
false
;
else
this
.
isAlive
=
true
;
}
public
boolean
isAliveInNextState
(
int
numberOfAliveNeighbours
)
{
if
(
isAlive
()){
if
(
numberOfAliveNeighbours
==
2
||
numberOfAliveNeighbours
==
3
)
return
true
;
else
return
false
;
}
else
{
if
(
numberOfAliveNeighbours
==
3
)
return
true
;
else
return
false
;
}
if
(
isAlive
()){
if
(
numberOfAliveNeighbours
==
2
||
numberOfAliveNeighbours
==
3
)
return
true
;
else
return
false
;
}
else
{
if
(
numberOfAliveNeighbours
==
3
)
return
true
;
else
return
false
;
}
}
}
Loading