1 /*
2 * The contents of this file are subject to the BT "ZEUS" Open Source
3 * Licence (L77741), Version 1.0 (the "Licence"); you may not use this file
4 * except in compliance with the Licence. You may obtain a copy of the Licence
5 * from $ZEUS_INSTALL/licence.html or alternatively from
6 * http://www.labs.bt.com/projects/agents/zeus/licence.htm
7 *
8 * Except as stated in Clause 7 of the Licence, software distributed under the
9 * Licence is distributed WITHOUT WARRANTY OF ANY KIND, either express or
10 * implied. See the Licence for the specific language governing rights and
11 * limitations under the Licence.
12 *
13 * The Original Code is within the package zeus.*.
14 * The Initial Developer of the Original Code is British Telecommunications
15 * public limited company, whose registered office is at 81 Newgate Street,
16 * London, EC1A 7AJ, England. Portions created by British Telecommunications
17 * public limited company are Copyright 1996-9. All Rights Reserved.
18 *
19 * THIS NOTICE MUST BE INCLUDED ON ANY COPY OF THIS FILE
20 */
21
22
23
24 package zeus.actors.graphs;
25
26 import java.util.*;
27 import zeus.util.*;
28 import zeus.concepts.*;
29 import zeus.actors.*;
30 import zeus.actors.rtn.*;
31 import zeus.actors.rtn.util.*;
32
33 public class Sc extends Node {
34 public Sc() {
35 super("Sc");
36 }
37 protected int exec() {
38 Engine engine = context.Engine();
39 Planner table = context.Planner();
40
41 GraphStruct gs = (GraphStruct)input;
42 Goal g;
43 DelegationStruct ds;
44 SuppliedDb db;
45 AuditTable audit = engine.getAuditTable();
46
47 for(int i = 0; i < gs.selection.size(); i++ ) {
48 ds = (DelegationStruct)gs.selection.elementAt(i);
49 g = (Goal)ds.goals.elementAt(0);
50 audit.add(g,ds.key,g.getCost(),false,false,ds.agent,
51 context.whoami(),g.getEndTime());
52 engine.continue_dialogue(ds.key,ds.agent,"accept-proposal",ds.goals);
53 /*
54 if ( (db = g.getSuppliedDb()) != null ) {
55 reservations = db.getReservations(context.whoami(),ds.agent);
56 audit.add(context.whoami(),reservations);
57 }
58 */
59 }
60 PlannerQueryStruct bind_data = table.clear_bind(gs.goal);
61 table.reconfirmParentOf(gs.goal);
62
63 output = gs;
64 return OK;
65 }
66 protected void reset() {
67 // reset any state changed by exec()
68 }
69 }