Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added FunApp parsing to the questions

  • Loading branch information...
commit f67295d71c08c5d0db61061d550992313320ce5b 1 parent 65bace2
Mikael Bung authored
Showing with 11 additions and 9 deletions.
  1. +11 −9 src/org/pathpal/DirectionsForm.java
20 src/org/pathpal/DirectionsForm.java
View
@@ -12,7 +12,6 @@
import android.location.Address;
public class DirectionsForm {
-
public enum TravelMethod {
UNKNOWN (Mode.DRIVING),
DRIVE (Mode.DRIVING),
@@ -53,7 +52,7 @@ public Mode realMode() {
// ambiguous data
public interface Question {
public String concreteQuestion();
- public void answerQuestion(FunApp answer);
+ public boolean answerQuestion(FunApp answer);
}
private class WaypointAddress implements Waypoint {
@@ -91,9 +90,9 @@ public AmbiguousWaypointQuestion(List<AddressPlace> waypoints,
this.waypointinfo = w;
}
- public void answerQuestion(FunApp answer) {
+ public boolean answerQuestion(FunApp answer) {
// TODO Auto-generated method stub
-
+ return false;
}
public String concreteQuestion() {
@@ -145,14 +144,17 @@ public AddressPlace findAddress(SearchApi api) throws IOException {
TravelMethodQuestion(Leg l) {
leg = l;
}
- public void answerQuestion(FunApp answer) {
- // TODO !!! DO SOMETHING !!
- /* if (answer == "walk") {
+ public boolean answerQuestion(FunApp answer) {
+ if (!answer.getIdent().equals("WalkOrTrans")) {
+ return false;
+ }
+ String id = ((FunApp)answer.getArgs().get(0)).getIdent();
+ if (id.equals("Walking")) {
leg.method(TravelMethod.WALK);
- } else if (answer == "car") {
+ } else if (id.equals("Transportation")) {
leg.method(TravelMethod.DRIVE);
}
- */
+ return true;
}
public String concreteQuestion() {
Please sign in to comment.
Something went wrong with that request. Please try again.