aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/fr/umlv/java/wallj/model/Block.java15
-rw-r--r--src/main/java/fr/umlv/java/wallj/model/BombBlock.java17
2 files changed, 32 insertions, 0 deletions
diff --git a/src/main/java/fr/umlv/java/wallj/model/Block.java b/src/main/java/fr/umlv/java/wallj/model/Block.java
index 7f32087..25265d1 100644
--- a/src/main/java/fr/umlv/java/wallj/model/Block.java
+++ b/src/main/java/fr/umlv/java/wallj/model/Block.java
@@ -72,4 +72,19 @@ public abstract class Block {
72 .collect(Collectors.toList()); 72 .collect(Collectors.toList());
73 } 73 }
74 74
75 @Override
76 public boolean equals(Object o) {
77 if (this == o) return true;
78 if (!(o instanceof Block)) return false;
79 Block block = (Block) o;
80 return type == block.type &&
81 Objects.equals(controllers, block.controllers) &&
82 Objects.equals(pos, block.pos);
83 }
84
85 @Override
86 public int hashCode() {
87 return Objects.hash(type, controllers, pos);
88 }
89
75} 90}
diff --git a/src/main/java/fr/umlv/java/wallj/model/BombBlock.java b/src/main/java/fr/umlv/java/wallj/model/BombBlock.java
index 9ba4a68..4eca843 100644
--- a/src/main/java/fr/umlv/java/wallj/model/BombBlock.java
+++ b/src/main/java/fr/umlv/java/wallj/model/BombBlock.java
@@ -2,6 +2,8 @@ package fr.umlv.java.wallj.model;
2 2
3import org.jbox2d.common.Vec2; 3import org.jbox2d.common.Vec2;
4 4
5import java.util.Objects;
6
5/** 7/**
6 * A bomb block. 8 * A bomb block.
7 * 9 *
@@ -25,4 +27,19 @@ public class BombBlock extends Block {
25 return timer; 27 return timer;
26 } 28 }
27 29
30 @Override
31 public boolean equals(Object o) {
32 if (this == o) return true;
33 if (!(o instanceof BombBlock)) return false;
34 if (!super.equals(o)) return false;
35 BombBlock bombBlock = (BombBlock) o;
36 return timer == bombBlock.timer &&
37 super.equals(o);
38 }
39
40 @Override
41 public int hashCode() {
42 return Objects.hash(super.hashCode(), timer);
43 }
44
28} 45}