|
Spirograph Problem Set Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectspirograph.SpiroUtils
This class contained a bunch of Utilities that were specific to this problem set, but only one of them turned out to be neccesary.
Copyright © 1998 Massachusetts Institute of Technology
Copyright © 2003 Franklin W. Olin College of Engineering
Accelerator
Field Summary | |
static java.lang.String[] |
RESERVED_WORDS
The reserved words for java 1.4. |
Constructor Summary | |
SpiroUtils()
|
Method Summary | |
static Accelerator |
createAccel(java.lang.String className)
This method reads in a class file, creates an Object from that class and casts it to an Accelerator. |
static double |
dist(double ax,
double ay,
double bx,
double by)
The distance between any two points in 2D space. |
static boolean |
inEllipse(double x,
double y,
double a,
double b)
Calculates whether or not a given position is inside a given ellipse. |
static boolean |
isReservedWord(java.lang.String someCode)
Check to see if a string contains a java reserved word. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String[] RESERVED_WORDS
Constructor Detail |
public SpiroUtils()
Method Detail |
public static boolean isReservedWord(java.lang.String someCode)
someCode
- The code or other string to check for reserved words
public static Accelerator createAccel(java.lang.String className)
Class.forName(String) caches names, if I ask it to reread a file that the user has changed it will return the old version of that file. Therefore, I use some system calls to copy the file to a new name, read it in and erase it.
This method is only used to load the classes, if any, specified as command line arguments when the program is started. It is not used to load the classes that are compiled during the execution of the program. To do this, a cs101.util.MultiClassLoader is used.
className
- The string specifying the name of the class to load
public static double dist(double ax, double ay, double bx, double by)
ax
- first x coordinateay
- first y coordinatebx
- second x coordinateby
- second y coordinate
public static boolean inEllipse(double x, double y, double a, double b)
x
- The x coordinate of the point being testedy
- The y coordinate of the point being testeda
- The major or minor axis of the elipse in the x directionb
- The major or minor axis of the elipse in the y direction
|
Spirograph Problem Set Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |