An error occurred while loading the file. Please try again.
-
Lambert Patrick authored770d96e0
package species;
import environment.Basin;
import environment.BasinNetwork;
import fr.cemagref.simaqualife.kernel.AquaNism;
import fr.cemagref.simaqualife.kernel.AquaNismsGroup;
import fr.cemagref.simaqualife.pilot.Pilot;
public class DiadromousFish extends AquaNism<Basin, BasinNetwork> {
public static enum Stage {IMMATURE, MATURE};
public static enum Gender {UNDIFFERENCIED, FEMALE, MALE};
private long amount;
private double age;
private double length;
private Basin birthBasin;
private Stage stage;
private Gender gender;
private int numberOfReproduction;
public DiadromousFish(Pilot pilot, Basin position, double initialLength, long fishAmount) {
this(pilot, position, initialLength, fishAmount, Gender.UNDIFFERENCIED);
}
public DiadromousFish(Pilot pilot, Basin position, double initialLength) {
this(pilot, position, initialLength, 1, Gender.UNDIFFERENCIED);
}
public DiadromousFish(Pilot pilot, Basin position, double initialLength, long fishAmount, Gender gender) {
super(pilot, position);
this.age = 0.;
this.length = initialLength;
this.birthBasin = position;
this.amount = fishAmount;
this.stage = Stage.IMMATURE;
this.gender = gender;
this.numberOfReproduction = 0;
}
public DiadromousFish duplicateWithNewPositionAndAmount(Pilot pilot, Basin newPosition, long newAmount){
DiadromousFish newFish=new DiadromousFish(pilot, newPosition, this.getLength(), newAmount, this.gender);
newFish.age = this.age;
newFish.birthBasin = this.birthBasin;
newFish.stage = this.stage;
newFish.numberOfReproduction = this.numberOfReproduction;
return newFish;
}
public Stage getStage() {
return stage;
}
public boolean isMature(){
return this.stage== Stage.MATURE;
}
public void setStage(Stage stage) {
this.stage = stage;
}
public int getNumberOfReproduction() {
return numberOfReproduction;
}
7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
public void incNumberOfReproduction() {
this.numberOfReproduction ++;
}
public long getAmount() {
return amount;
}
public void setAmount(long fishAmount) {
this.amount = fishAmount;
}
public double getAge() {
return age;
}
public void setAge(double age) {
this.age = age;
}
public double getLength() {
return length;
}
public void setLength(double length) {
this.length = length;
}
public Basin getBirthBasin() {
return birthBasin;
}
/**
* @return the gender
*/
public Gender getGender() {
return gender;
}
@Override
public <ANG extends AquaNismsGroup<?, BasinNetwork>> void moveTo(
Pilot pilot, Basin destination, ANG group) {
if (this.position != destination) {
this.position.removeFish(this, (DiadromousFishGroup) group);
destination.addFish(this, (DiadromousFishGroup) group);
}
super.moveTo(pilot, destination, group);
}
}