lejos.robotics.pathfinding.Path Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lejos-ev3-api Show documentation
Show all versions of lejos-ev3-api Show documentation
leJOS (pronounced like the Spanish word "lejos" for "far") is a tiny Java Virtual Machine. In 2013 it was ported to the LEGO EV3 brick.
The newest version!
package lejos.robotics.pathfinding;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import lejos.robotics.Transmittable;
import lejos.robotics.navigation.Waypoint;
/**
* Represents a path consisting of an ordered collection of waypoints
*
* @author Lawrie Griffiths
*
*/
public class Path extends ArrayList implements Transmittable {
public void dumpObject(DataOutputStream dos) throws IOException {
dos.writeInt(this.size());
for(Waypoint wp: this) {
wp.dumpObject(dos);
}
}
public void loadObject(DataInputStream dis) throws IOException {
int n = dis.readInt();
this.clear();
for(int i=0;i