I’m programming genetic processes in java for my project and I want simulate the mitosis of a human cell. A human cell contains 23 pairs of chromosome. Mitosis is basically a cell division, or reproduction, in which a cell gives rise to two genetically identical daughter cells. You can find a picture about it here (scroll a little bit down the page):
I think that this mitosis would be like a java method in a class “Cell” for example. So i made a class Chromosome with it’s own methods to represent a single chromosome and made a class “Cell” containing 23 pairs of chromosomes. I plan on putting the method mitosis in the class Cell but the problem is that this method should return 2 identical cells and I think it’s impossible to create a method that returns 2 cells in this class.
I thought about making a method that would return an array of 2 cells it doesn’t work.
Any suggestions an how to create this method? Or maybe another approach than the one i’m using? Thanks.
I would suggest that
Cell implements Cloneableand use the copy constructor idiom onclone()method.On
doMitosis()method inCellyou basically do something like this:PS. Code is a rough sketch, not actual implementation. Also, this code takes into consideration that the parent cell must be killed (and garbage collected) so that the 2 identical cells can have right of way.