|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsnakeprogram.Snake
public class Snake
Field Summary | |
---|---|
static int |
CLOSED_SNAKE
|
static int |
OPEN_SNAKE
|
int |
TYPE
|
Constructor Summary | |
---|---|
Snake(java.util.ArrayList<double[]> coord,
int i,
int type)
Creates a new snake with position data. |
|
Snake(int type)
Creates a new snake does not have any position data |
Method Summary | |
---|---|
void |
addCoordinates(int frame,
java.util.ArrayList<double[]> Xs)
Adds or replaces the coordinates in the frame. |
void |
clearSnake(int frame)
Removes the snake from frame, note frames start at 1 |
boolean |
exists(int frame)
Checks if snake exists in frame |
double |
findLength(int time)
Finds the length, cumulative distance between points in a given frame. |
java.util.ArrayList<double[]> |
getCoordinates(int i)
|
int |
getLastFrame()
|
int |
getSize(int frame)
Gets the number of points in the given frame |
boolean |
isEmpty()
Checks every frame to see if the snake is too short then returns whether or not there are snakes left |
java.util.Iterator<java.lang.Integer> |
iterator()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int OPEN_SNAKE
public static final int CLOSED_SNAKE
public final int TYPE
Constructor Detail |
---|
public Snake(int type)
type
- could be either an OPEN_SNAKE or a CLOSED_SNAKE for the respective curve typespublic Snake(java.util.ArrayList<double[]> coord, int i, int type)
coord
- xcoordinatesi
- frame that the current coordinates correspond too.type
- could be either an OPEN_SNAKE or a CLOSED_SNAKE for the respective curve typesMethod Detail |
---|
public java.util.ArrayList<double[]> getCoordinates(int i)
public double findLength(int time)
public int getSize(int frame)
public boolean exists(int frame)
public void clearSnake(int frame)
frame
- the frame to be removed frompublic boolean isEmpty()
public void addCoordinates(int frame, java.util.ArrayList<double[]> Xs)
frame
- frame that will recieve the new coordinatesXs
- x coordinatespublic java.util.Iterator<java.lang.Integer> iterator()
iterator
in interface java.lang.Iterable<java.lang.Integer>
public int getLastFrame()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |