Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fakarava.ecosystem;
- import fakarava.controls.Clock;
- import java.util.Collection;
- public class Fish implements Clock {
- /**
- * @attribute
- */
- private Integer age;
- /**
- * @attribute
- * @associates <{Integer}>
- */
- private Integer[] position;
- /**
- * @attribute
- */
- private Integer numberOfFish;
- /**
- * @attribute
- */
- private String name;
- /**
- * @attribute
- */
- private Integer id;
- /**
- * @attribute
- */
- private Real weight;
- public Fish(String name, Double weight) {
- this.name=name;
- this.weight=weight;
- this.id=id+1;
- numberOfFish++;
- }
- public Fish(String name, Double weight, Integer age, Collection position) {
- this.name=name;
- this.weight=weight;
- this.id=id+1;
- this.age=age;
- numberOfFish++;
- //this.position=;
- }
- public Fish clone(Fish toClone) {
- Fish newFish = new Fish("FilsDe"+ toClone.getName(), toClone.getWeight(), toClone.getage(), toClone.getPosition());
- return newFish;
- }
- public Boolean isOverpopulated() {
- if(checkCapacity() == Lagun.getDENSITY_MAX())
- return true;
- else return false;
- }
- public void checkGame(){
- if(isOverpopulated())
- {
- System.out.println("Le lagon est surpeuplé. \n\r Fin de simulation.");
- System.exit(0); //exit app
- }
- }
- public Integer checkCapacity() {
- return numberOfFish;
- }
- public void setAge(Integer age) {
- this.age = age;
- }
- public Integer getAge() {
- return age;
- }
- public void setPosition(Integer[] position) {
- this.position = position;
- }
- public Integer[] getPosition() {
- return position;
- }
- public void setName(String name) {
- this.name = name;
- }
- public String getName() {
- return name;
- }
- public void setId(Integer id) {
- this.id = id;
- }
- public Integer getId() {
- return id;
- }
- public void setage(Integer age) {
- this.age = age;
- }
- public Integer getage() {
- return age;
- }
- public void setWeight(Double weight) {
- this.weight = weight;
- }
- public Double getWeight() {
- return weight;
- }
- @Override
- public void tictock() {
- // TODO Implement this method
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement