From: yoriy <yo...@us...> - 2012-07-20 13:55:26
|
Update of /cvsroot/arianne/stendhal/src/games/stendhal/server/entity/npc/fsm In directory vz-cvs-4.sog:/tmp/cvs-serv16240/src/games/stendhal/server/entity/npc/fsm Modified Files: Engine.java Log Message: added missed "add" method and fixed error in other "add" method Index: Engine.java =================================================================== RCS file: /cvsroot/arianne/stendhal/src/games/stendhal/server/entity/npc/fsm/Engine.java,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** Engine.java 20 Jul 2012 08:09:03 -0000 1.67 --- Engine.java 20 Jul 2012 13:55:23 -0000 1.68 *************** *** 122,126 **** * @param state * old state ! * @param triggerStrings * input trigger * @param condition --- 122,126 ---- * @param state * old state ! * @param triggerString * input trigger * @param condition *************** *** 135,143 **** * additional action after the condition */ ! public void add(final ConversationStates state, final Collection<String> triggerStrings, final ChatCondition condition, boolean secondary, final ConversationStates nextState, final String reply, final ChatAction action, final String label) { Collection<Expression> triggerExpressions = createUniqueTriggerExpressions( ! state, triggerStrings, null, condition, reply, action); add(triggerExpressions, state, condition, secondary, nextState, reply, action, label); --- 135,143 ---- * additional action after the condition */ ! public void add(final ConversationStates state, final String triggerString, final ChatCondition condition, boolean secondary, final ConversationStates nextState, final String reply, final ChatAction action, final String label) { Collection<Expression> triggerExpressions = createUniqueTriggerExpressions( ! state, Arrays.asList(triggerString), null, condition, reply, action); add(triggerExpressions, state, condition, secondary, nextState, reply, action, label); *************** *** 175,178 **** --- 175,210 ---- } + + /** + * Adds a new set of transitions to the FSM. + * + * @param state + * the starting state of the FSM + * @param triggerStrings + * a list of inputs for this transition, must not be null + * @param condition + * null or condition that has to return true for this transition + * to be considered + * @param secondary + * flag to mark secondary transitions to be taken into account after preferred transitions + * @param nextState + * the new state of the FSM + * @param reply + * a simple sentence reply (may be null for no reply) + * @param action + * a special action to be taken (may be null) + */ + public void add(final ConversationStates state, final Collection<String> triggerStrings, final ChatCondition condition, + boolean secondary, final ConversationStates nextState, final String reply, final ChatAction action, final String label) { + if (triggerStrings == null) { + throw new IllegalArgumentException("trigger list must not be null"); + } + + Collection<Expression> triggerExpressions = createUniqueTriggerExpressions( + state, triggerStrings, null, condition, reply, action); + + add(triggerExpressions, state, condition, secondary, nextState, reply, action, label); + } + /** * Adds a new transition with explicit ExpressionMatcher to FSM. |