Skip to content

Commit

Permalink
Fixes #133
Browse files Browse the repository at this point in the history
  • Loading branch information
pablo.rodriguez.mier committed Aug 3, 2015
1 parent abb4a1e commit c4ed9c9
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import es.usc.citius.hipster.model.function.ActionFunction;
import es.usc.citius.hipster.model.function.ActionStateTransitionFunction;
import es.usc.citius.hipster.model.function.TransitionFunction;
import es.usc.citius.hipster.util.F;
import es.usc.citius.hipster.util.Function;

import java.util.ArrayList;

Expand Down Expand Up @@ -52,12 +54,11 @@ public LazyActionStateTransitionFunction(ActionFunction<A, S> af, ActionStateTra

@Override
public Iterable<Transition<A, S>> transitionsFrom(final S state) {
ArrayList<Transition<A, S>> transitions = new ArrayList<Transition<A, S>>();
//generate set of actions
for(A applicableAction : af.actionsFor(state)){
//generate transition for each action
transitions.add(new Transition<A, S>(state, applicableAction, tf.apply(applicableAction, state)));
}
return transitions;
return F.map(af.actionsFor(state), new Function<A, Transition<A, S>>() {
@Override
public Transition<A, S> apply(A a) {
return Transition.create(state, a, tf.apply(a, state));
}
});
}
}

0 comments on commit c4ed9c9

Please sign in to comment.