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.util.Comparator;
21:
22: /**
23: * Extended knowledge base class that offers additional functionality
24: * to maintain the knowledge base. In particular, there are methods to
25: * order clause sets either manually (move operations) or automatically
26: * (comparators determining the order of clauses). <br>
27: * If a comparator is set, the move operations should be disabled (do nothing).
28: * Therefore, the <code>isMoveEnabled</code> operation should return
29: * <code>getComperator()!=null</code>.
30: * <strong>Warning:</strong> Note that the order of the clause sets often
31: * affects the results of a query (e.g., conflict resolution by assigning
32: * priorities).
33: * @author <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</A>
34: * @version 3.4 <7 March 05>
35: * @since 1.1
36: */
37: public interface ExtendedKnowledgeBase extends KnowledgeBase {
38:
39: /**
40: * Move a clause set down. (= assign a lower priority)
41: * @param cs the respective clause set
42: */
43: void moveDown(ClauseSet cs);
44:
45: /**
46: * Move a clause set to the button. (= assign the lowest priority)
47: * @param cs the respective clause set
48: */
49: void moveToBottom(ClauseSet cs);
50:
51: /**
52: * Move a clause set to the top. (= assign the highest priority)
53: * @param cs the respective clause set
54: */
55: void moveToTop(ClauseSet cs);
56:
57: /**
58: * Move a clause set up. (= assign a higher priority)
59: * @param cs the respective clause set
60: */
61: void moveUp(ClauseSet cs);
62:
63: /**
64: * Set a comperator.
65: * @param comp a comparator
66: */
67: void setComparator(java.util.Comparator comp);
68:
69: /**
70: * Get the comperator.
71: * @param comp a comparator
72: */
73: Comparator getComparator();
74:
75: /**
76: * Indicates whether the (manual) move operations are enabled.
77: * @return a boolean
78: */
79: boolean isMoveEnabled();
80:
81: /**
82: * Resort all entries. Does nothing if the comparator is null.
83: */
84: void resort();
85:
86: /**
87: * Resort all entries for a particular key. Does nothing if the comparator is null.
88: * @param key a key (a predicate)
89: */
90: void resort(Object key);
91:
92: }
|