001 // this class will hold information about space objects, 002 // i.e. planets, asteriods, alien space ships and other stuff 003 004 /** 005 * This class represents a space object i.e. a planet, moon or asteroid. 006 * Contains initial position, velocity and mass and a bunch other usefull 007 * parameters which I might need to either store or access during the project. 008 * @author Markus Signitzer 009 */ 010 public class SpaceObject{ 011 /** Will hold initial conditions.*/ 012 PointN initial; 013 /** Will hold momentary coordinates and velocities.*/ 014 PointN now; 015 /** Holds the mass of the object in kg (SI unit).*/ 016 double mass; 017 /** Will store the current time step of the integrator.*/ 018 int timeStep; 019 /** if display is true then the trajectory of the object will be draw to the screen.*/ 020 boolean display; 021 022 /** 023 * Constructs a <code>SolarObject</code> which will hold inital and current information about 024 * this object. 025 * 026 * @param i the initial conditions. i.e. Positions and velocities in cartesian coordinates. 027 * @param m the mass of the object. 028 */ 029 public SpaceObject(PointN i, double m){ 030 this.initial = i; 031 this.now = i; 032 this.mass = m; 033 this.timeStep = 0; 034 this.display = false; 035 } 036 /** 037 * Method for accessing the boolean variable display. 038 * A value of TRUE means that the trajectory of the object is displayed. 039 * @return <code>boolean</code> representing the status of the display boolean in this object. 040 */ 041 public boolean getDisplay(){ 042 return this.display; 043 } 044 /** 045 * Method for setting the boolean variable display. 046 * A value of TRUE means that the trajectory of the object is displayed. 047 * @param b <code>boolean</code> representing the status of the display boolean in this object. 048 */ 049 public void setDisplay(boolean b){ 050 this.display = b; 051 } 052 /** 053 * Method for accessing the initial conditions of this space object. 054 * @return <code>PointN</code> holding the initial conditions of this object. 055 */ 056 public PointN getI(){ 057 return this.initial; 058 } 059 /** 060 * Method for accessing the current coordinates of this space object. 061 * @return <code>PointN</code> holding the current coordinates and velocities. 062 */ 063 public PointN getC(){ 064 return this.now; 065 } 066 /** 067 * Method for accessing the mass of this space object. 068 * @return <code>double</code>. 069 */ 070 public double getM(){ 071 return this.mass; 072 } 073 /** 074 * Method for updating the mass of this space object. 075 * @param m <code>double</code> the new mass of the space object. 076 */ 077 public void setM(double m){ 078 this.mass = m; 079 } 080 /** 081 * Method for updating the current coordinates of this space object. 082 * @param c <code>PointN</code> holding the current coordinates and velocities. 083 */ 084 public void setC(PointN c){ 085 this.now = c; 086 } 087 /** 088 * Method for increasing the stored time steps by one time step. 089 */ 090 public void plusOneTime(){ 091 this.timeStep = this.timeStep + 1; 092 } 093 /** 094 * Method to get the number of calculated time steps so far. 095 * @return <code>int</code>. 096 */ 097 public int getTime(){ 098 return this.timeStep; 099 } 100 101 } 102