1 package JSci.physics; 2 3 import JSci.GlobalSettings; 4 import JSci.physics.relativity.*; 5 6 12 public abstract class RelativisticParticle extends Particle { 13 16 public RelativisticParticle() {} 17 20 public abstract double restMass(); 21 24 public Rank1Tensor position=new Rank1Tensor(0.0,0.0,0.0,0.0); 25 28 public Rank1Tensor momentum=new Rank1Tensor(0.0,0.0,0.0,0.0); 29 33 public boolean equals(Object p) { 34 return (p!=null) && (p instanceof RelativisticParticle) && 35 (position.equals(((RelativisticParticle)p).position)) && 36 (momentum.equals(((RelativisticParticle)p).momentum)) && 37 (Math.abs(restMass()-((RelativisticParticle)p).restMass())<=GlobalSettings.ZERO_TOL); 38 } 39 public int hashCode() { 40 return (int) restMass(); 41 } 42 } 43 44 | Popular Tags |