public class Atom extends SimpleGene
| Modifier and Type | Field and Description | 
|---|---|
double | 
angle
Original documentation:
 
 also used in an AnimalTrunk to store the number of atoms in the
 animal.
 also used in SectionTrunk to store the Overlap of segments
 also used in SegmentTrunk to store the rank number of the
 segment
  
 | 
Atom | 
firstBelowMe
Original documentation: where to look in the BoneYard for the next atom. 
 | 
int | 
gradientGene  | 
double | 
height
Original documentation: Also used for Thickness of a Joint 
 | 
AtomKind | 
kind  | 
Atom | 
nextLikeMe
Original documentation: Where to look in the BoneYard for the next atom. 
 | 
int | 
segmentNumber  | 
double | 
width
Original documentation: Also used for Length of a Joint 
 | 
| Constructor and Description | 
|---|
Atom(ArthromorphGenome genome)  | 
Atom(ArthromorphGenome genome,
    AtomKind kind)  | 
Atom(ArthromorphGenome genome,
    AtomKind kind,
    double height,
    double width,
    double angle,
    int gradientGene,
    Atom nextLikeMe,
    Atom firstBelowMe)  | 
| Modifier and Type | Method and Description | 
|---|---|
Atom | 
copy(Genome genome)  | 
Atom | 
copyExceptNext(Genome genome)  | 
int | 
countAtoms()
Recursively traverse tree of atoms to calculate the total number of atoms
 in the tree. 
 | 
int | 
depthBelow(Atom ancestor,
          Atom descendent)  | 
boolean | 
doDelete()
Original Documentation 
 | 
void | 
geneManipulated(GeneManipulationEvent gbme)  | 
boolean | 
genomicallyEquals(Gene gene)  | 
double | 
getAngle()  | 
Atom | 
getFirstBelowMe()  | 
int | 
getGradientGene()  | 
double | 
getHeight()  | 
AtomKind | 
getKind()  | 
Atom | 
getNextLikeMe()  | 
double | 
getWidth()  | 
void | 
kill()
Original Documentation 
 | 
void | 
readValueFromByteBuffer(java.nio.ByteBuffer byteBuffer)  | 
void | 
setAngle(double angle)  | 
void | 
setFirstBelowMe(Atom firstBelowMe)  | 
void | 
setGradientGene(int gradientGene)  | 
void | 
setHeight(double newValue)  | 
void | 
setKind(AtomKind kind)  | 
void | 
setNextLikeMe(Atom nextLikeMe)  | 
void | 
setWidth(double newValue)  | 
java.lang.String | 
toString()  | 
java.util.Vector<Atom> | 
toVector()  | 
void | 
writeValueToByteBuffer(java.nio.ByteBuffer byteBuffer)  | 
addPropertyChangeListener, copy, getDoubleGooseSize, getGenome, getGooseSize, getName, readIndexedValueFromByteBuffer, removePropertyChangeListener, setGenome, setName, writeIndexedValueToByteBufferpublic double angle
public Atom firstBelowMe
public int gradientGene
public double height
public AtomKind kind
public Atom nextLikeMe
public int segmentNumber
public double width
public Atom(ArthromorphGenome genome)
public Atom(ArthromorphGenome genome, AtomKind kind)
public Atom(ArthromorphGenome genome, AtomKind kind, double height, double width, double angle, int gradientGene, Atom nextLikeMe, Atom firstBelowMe)
public int countAtoms()
In Classic Arthromorphs, the NextLikeMe field for AnimalTrunk was used to store the gradient gene. In the Java version, gradient is separately tracked in the Arthromorph class. For this reason, the "kind != AnimalTrunk" check is not needed.
        function CountAtoms (which: integer): integer;
        {travel over the Animal, counting Atoms}
                var
                        count: integer;
        begin
                count := 1;     {count me}
                with BoneYard[which]^^ do
                        begin
                                if FirstBelowMe <> 0 then
                                        count := count + CountAtoms(FirstBelowMe);
                                if (NextLikeMe <> 0) and (kind <> AnimalTrunk) then
                                        count := count + CountAtoms(NextLikeMe);
                        end;
                CountAtoms := count;    {Me and all below me}
        end;
 public boolean doDelete()
Delete a section of the animal somewhere near the atom which.
Caller must correct the AtomCount of the whole animal. Return false if failed
Must have a hold on the atom above what we delete. If chosen atom is:
AnimalTrunk   delete first Sec
        AnimalJoint   delete first Sec
        AnimalClaw      delete first Sec
                SectionTrunk    delete next Sec
                        SectionJoint            delete first Seg
                        SectionClaw             delete first Seg
                                SegmentTrunk            delete next Seg
                                        SegmentJoint            delete first Joint
                                        SegmentClaw             delete first Joint
                                                Joint                           delete next Joint
                                                Joint                           delete next Joint
                                                Joint                           delete Claw
                                                        Claw                            fail
 
 Also fail if trying to delete last example of a Kind
public void geneManipulated(GeneManipulationEvent gbme)
public double getAngle()
public Atom getFirstBelowMe()
public int getGradientGene()
public double getHeight()
public AtomKind getKind()
public Atom getNextLikeMe()
public double getWidth()
public void kill()
Destroy this animal. Mark all of its Atoms as Free again.
Recursively step through the animal
kill in interface Genekill in class SimpleGenepublic void setAngle(double angle)
public void setFirstBelowMe(Atom firstBelowMe)
public void setGradientGene(int gradientGene)
public void setHeight(double newValue)
public void setKind(AtomKind kind)
public void setNextLikeMe(Atom nextLikeMe)
public void setWidth(double newValue)
public java.lang.String toString()
toString in class java.lang.Objectpublic java.util.Vector<Atom> toVector()
public void readValueFromByteBuffer(java.nio.ByteBuffer byteBuffer)
readValueFromByteBuffer in interface GenereadValueFromByteBuffer in class SimpleGenepublic void writeValueToByteBuffer(java.nio.ByteBuffer byteBuffer)
writeValueToByteBuffer in interface GenewriteValueToByteBuffer in class SimpleGenepublic boolean genomicallyEquals(Gene gene)