1 package JSci.chemistry; 2 3 import JSci.physics.*; 4 import JSci.physics.particles.*; 5 6 11 public class Atom extends Particle { 12 15 private Lepton shell[]; 16 private final int shellSize; 17 20 private Nucleon nucleus[]; 21 private final int nucleusSize; 22 25 public Atom(Element e) { 26 shellSize = e.getAtomicNumber(); 27 nucleusSize = e.getMassNumber(); 28 } 29 32 public Nucleon[] getNucleus() { 33 if(nucleus == null) { 34 nucleus = new Nucleon[nucleusSize]; 35 int i; 36 for(i=0; i<shellSize; i++) 37 nucleus[i] = new Proton(); 38 for(; i<nucleusSize; i++) 39 nucleus[i] = new Neutron(); 40 } 41 return nucleus; 42 } 43 46 public Lepton[] getShell() { 47 if(shell == null) { 48 shell = new Lepton[shellSize]; 49 for(int i=0; i<shellSize; i++) 50 shell[i] = new Electron(); 51 } 52 return shell; 53 } 54 57 public Molecule bind(Atom a) { 58 return new Molecule(this, a); 59 } 60 } 61 62 | Popular Tags |