01: /*
02: * Copyright (C) 1999-2004 <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</a>
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18: package org.mandarax.kernel;
19:
20: import java.io.Serializable;
21:
22: /**
23: * Derivation nodes represent the application of a single clause (usually a rule) in a derivation.
24: * @author <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</A>
25: * @version 3.4 <7 March 05>
26: * @since 1.0
27: */
28: public interface DerivationNode extends Serializable {
29:
30: // constant for the state of a derivation node
31: //@deprecated see getState()
32: public final static byte UNKNOWN = 0;
33: public final static byte FAILED = 1;
34: public final static byte SUCCESS = 2;
35: public final static byte IRRELEVANT = 3;
36:
37: /**
38: * Get the applied clause.
39: * @return the applied clause
40: */
41: public Clause getAppliedClause();
42:
43: /**
44: * Get the query (= goal).
45: * @return the query
46: */
47: public Clause getQuery();
48:
49: /**
50: * Get the state of the derivation node. I.e., basically whether this
51: * derivation step has failed or not. Possible states are defined in
52: * this interface by static variables. There is also a state indicating that
53: * a derivation node is irrelevant, e.g. if a node is in a proof tree containing
54: * derivations for many solutions but the structure is only considered in the
55: * context of one special solution. Then a node successful w.r.t. one solutions
56: * might be irrelevant w.r.t. another solution.
57: * @deprecated the idea of this method was to figure out which results are supported
58: * by this node. This is now achieved by isSupported
59: * @return the state of this node
60: * @see #FAILED
61: * @see #IRRELEVANT
62: * @see #SUCCESS
63: * @see #UNKNOWN
64: */
65: int getState();
66:
67: /**
68: * Indicates whether the result at the given index is supported by this node.
69: * @param int resultNumber - the number of the result in the result set indexing starts with 0
70: * @return boolean
71: */
72: boolean isSupported(int resultNumber);
73:
74: /**
75: * Get an array of integers containing the indexes of all solutions supported.
76: * @return an array of integer
77: */
78: int[] getSupportedResults();
79:
80: /**
81: * Returns the sub nodes of this node.
82: * @return the list of children (sub nodes)
83: */
84: java.util.List getSubNodes();
85:
86: /**
87: * Get the unification.
88: * @return the unification performed
89: */
90: public Unification getUnification();
91:
92: /**
93: * Indicates whether this derivation step has failed.
94: * @return true if this proof step has failed, false otherwise
95: */
96: public boolean isFailed();
97: }
|