1 /*********************************************************************
2 Copyright 2012, Ralph Ronnquist.
4 This file is part of GORITE.
6 GORITE is free software: you can redistribute it and/or modify it
7 under the terms of the Lesser GNU General Public License as published
8 by the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 GORITE is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the Lesser GNU General Public
17 License along with GORITE. If not, see <http://www.gnu.org/licenses/>.
18 **********************************************************************/
20 package com.intendico.gorite;
22 import com.intendico.data.Query;
25 * The Precedence interface is intended to be implemented by a {@link
26 * Goal} class that wants to suggest its precedence among alternative
27 * {@link Plan} options for a {@link BDIGoal} goal.
29 public interface Precedence {
32 * The precedence method is invoked by {@link
33 * BDIGoal.BDIInstance#action} in order to sort the collection of
34 * plans such that higher precedence plans are attempted before
35 * lower precedence plans.
37 * <p> A {@link Goal} without Precedence implementation is
38 * assigned the precedence value of 5.
40 * <p> Note that this method is invoked for each of any multiple
41 * bindings defined by a {@link Plan#context} {@link Query}, with
42 * the relevant bindings assigned into the {@link Data} object
43 * provided. The same {@link Data} object will be used for the
44 * successive {@link #precedence} calls, but with the bindings
45 * successively updated to pin point the relevant plan
48 public int precedence(Data d);