Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Game of life Toullec
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
TOULLEC Romain
Game of life Toullec
Commits
620db9c5
Commit
620db9c5
authored
1 year ago
by
Guyslain
Browse files
Options
Downloads
Patches
Plain Diff
section 8 Cell fini
parent
11d9207d
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/model/Cell.java
+8
-6
8 additions, 6 deletions
src/main/java/model/Cell.java
with
8 additions
and
6 deletions
src/main/java/model/Cell.java
+
8
−
6
View file @
620db9c5
...
...
@@ -13,7 +13,7 @@ import java.util.List;
*/
public
class
Cell
<
T
>
implements
Lens
<
T
>
{
//TODO: ajouter la ou les propriétés nécessaires
private
T
content
;
// la liste des objets écoutant les modifications du contenu de la cellule
private
final
List
<
OnChangeListener
<
T
>>
listeners
=
new
ArrayList
<>();
...
...
@@ -23,7 +23,7 @@ public class Cell<T> implements Lens<T> {
* @param initialContent the value initially stored by the cell.
*/
public
Cell
(
T
initialContent
)
{
//TODO: à compléter
this
.
content
=
initialContent
;
}
/** Add a {@link OnChangeListener} to react to any change of value in the cell.
...
...
@@ -42,8 +42,11 @@ public class Cell<T> implements Lens<T> {
* @param value the new content of this {@link Cell}
*/
public
void
set
(
T
value
)
{
//TODO: modifier le contenu de la cellule, puis appeler les méthodes valueChanged des
// listeners
T
oldValue
=
this
.
content
;
this
.
content
=
value
;
for
(
OnChangeListener
<
T
>
listener
:
this
.
listeners
)
{
listener
.
valueChanged
(
oldValue
,
value
);
}
}
/**
...
...
@@ -52,7 +55,6 @@ public class Cell<T> implements Lens<T> {
* @return the current content of this {@link Cell}
*/
public
T
get
(){
//TODO: à compléter
return
null
;
return
this
.
content
;
}
}
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