-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUniverseReader.java
More file actions
41 lines (38 loc) · 1.12 KB
/
UniverseReader.java
File metadata and controls
41 lines (38 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/**
* Abstract class for reading in a file of two dimensional circular bodies for
* physics simulations. Sub-classes just need to implement a constructor
* that reads from an input source and initializes the protected instance
* variables.
* @author Sean Stern
* @version 1.0
*/
public abstract class UniverseReader{
protected double universeRadius;
protected Body[] bodies;
/**
* Returns an array of {@link Body} objects based on an input file.
*
* @return an array of {@link Body} objects.
*/
public Body[] getBodies(){
return bodies;
}
/**
* Returns the radius of the universe that {@link Body} objects will
* occupy. The radius of the universe is defined as the minimum distnace
* from the center to an edge. For example, the universe below with a
* center at the period (.) has a radius of 2:
*
* _ _ _ _
* | |
* | ._ _| <--Example (square) universe with radius 2
* | |
* |_ _ _ _|
*
*
* @return the radius of the universe
*/
public double getUniverseRadius(){
return universeRadius;
}
}