设为首页收藏本站

最大的系统仿真与系统优化公益交流社区

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 13678|回复: 1

[求助] 总是出现swarm.SignatureNotFoundException错误

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑 / j% K$ J1 \0 a$ d* U
* Z0 S( u  S, w  S* _
本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21
% }3 z; q6 t/ G5 p0 J# y以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.( E; _# U& n, ?) k& n9 A7 }8 w; ^. ^
swarm.SignatureNotFoundException8 _6 l/ u9 E+ x3 n
        at swarm.Selector.<init>(Selector.java:76)) w' K" w9 o8 f( {, i9 j
        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)
. d/ O- E6 N" p8 \& `" d+ A8 |        at ActionGroupDemo.main(ActionGroupDemo.java:67)  Y, g' V% [8 [' r

1 R/ W2 ?3 Q$ r8 i/ e8 \. [) I( Q$ I) ~, ]8 C4 b
import swarm.objectbase.SwarmImpl;
) S5 [, d. c0 s" Z) g% t& Cimport swarm.objectbase.Swarm;
) w% n$ m5 k; Q5 C+ M3 i% ?import swarm.activity.ScheduleImpl;  i, U: x# J8 @1 R" Z# d4 T
import swarm.activity.Activity;& g* [- W* i! {# n
import swarm.activity.ActionGroupImpl;
3 \3 v" }7 i% @3 k2 ^6 X; P/ ~" pimport swarm.collections.ListImpl;
7 P* Q2 ~+ h/ }+ }import swarm.defobj.Zone;
9 @" d8 D% U2 S7 s# Iimport swarm.Globals;
# H7 g2 I, M8 o& _7 ~( D1 R; eimport swarm.Selector;+ {$ A" D% w3 }
import swarm.activity.ActionGroup; / k" [( B! z/ m/ E, l3 i% m9 [
class Agent {
/ _, O# }/ J* N0 M; w3 [$ ]: A        char id;
5 \3 k3 m3 A6 s  s- a/ N$ t' z2 V0 u$ g* S$ S) m; R  Z, x+ V
        Agent(char id) {% n+ h/ E0 m: x# P
                this.id = id;+ j7 k( h' w1 i8 i9 L
        }! X9 g% ]* k% p" V( ?1 \
! }% b! d4 S* ]7 C3 q' W2 t
        public void agentStep() {
% y: t' F) q* {1 d! _                System.out.println(id + ":" + Globals.env.getCurrentTime());! Y$ B8 |) t) m: u, _
        }
8 o- N( ?3 L: k# \}
5 n3 w1 K  I' R1 ^; e7 X9 f8 G) P& l. k6 @4 T6 x4 I8 b7 d
public class ActionGroupDemo extends SwarmImpl {
) y6 l2 F# T, _6 B$ T        ScheduleImpl schedule;$ t# C5 z4 K/ o' [% f. x5 G! F+ J
        ActionGroupImpl actionGroup;
/ h: e" s. l. n0 r# ^' ~' q        ListImpl list;
: h% w. ]( T3 r5 d7 n- V. N        char Id = 'a';
2 B" ?# y( C/ d) n$ D% T0 r4 u  _& i3 l! Q4 W! d& S
        ActionGroupDemo(Zone aZone) {. U2 w3 d+ l9 m& }# A, L3 G. U3 g0 t
                super(aZone);6 Y" ]; q4 {/ p1 C% D, D
                list = new ListImpl(aZone);
& l; j2 D2 F: X6 e                swarmSetp();7 R, r# o( W9 F1 G: n
                actionGroup = new ActionGroupImpl(aZone);
" f! Q; v0 ]1 E! r                schedule = new ScheduleImpl(aZone);
# [% @& {+ p; J3 w& U                try {. @& Q& `8 t9 J/ k" W) Z
                        Selector agentSel = new Selector(Agent.class, "agentStep", false);# }4 N  d  Y: r2 `  R  c
                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行" O- o# B+ b/ Q/ V
                        
8 x# Q) o: k$ W                        actionGroup.createActionForEach$message(list, agentSel);
% l1 l7 V& N, E# g/ J! m                        actionGroup.createActionTo$message(this, swarmSel);
+ \! `  k" i. L" Y0 u2 @                        schedule.at$createAction(0, actionGroup);' @8 O; j1 P# [7 y
                        schedule.at$createAction(1, actionGroup);
) e1 }. ]/ O% o  |                        schedule.at$createAction(2, actionGroup);
8 M( f5 w1 W( k) K- I1 N
, g4 |5 r; {, F& _! v" o! K                } catch (Exception e) {& Y0 z! u* |# t4 S: [
                        e.printStackTrace(System.err);
. b2 J; {8 \% X3 R; l# m3 |3 T) d8 q                        //System.out.println(e);
' U7 W6 I- V2 V                        System.exit(1);9 X9 S" u$ X: y0 v( ^
                }
9 t3 V0 g, B0 P# H9 [- {7 J4 }  R0 I* A
. S9 A& n; }+ r8 M" h0 g
        }
* J7 G+ y$ K/ R3 a+ R
, g0 k0 d) }: _1 S6 e! _* y+ D4 h) P        private void swarmSetp() {$ ~( I0 N6 ^% d% \/ l  c
                list.addLast(new Agent(Id));( F7 u6 n! E: ]8 {3 _6 O
                Id++;: a# a2 H- ?! W% O  P
        }# K# w# U1 ^5 G+ `- K' S& t

( `5 d* y7 B. o( u3 m) o        public Activity activateIn(Swarm context) {. V: m" {# D9 b
                super.activateIn(context);# d. E" r; ~1 A6 S$ \! z+ ~
                schedule.activateIn(this);' a% [# O8 ?# J' y6 |6 T
                return getActivity();& ]" h9 y! S& C) u' o3 L+ Y. [0 p
        }
& V- ~% V( f& V% W$ J* `9 S3 o' F8 c7 g0 }0 H
        public static void main(String[] args) {
, [1 q- ~* ^6 `" C& c& d                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);6 F: L# |: t4 U0 x
                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);
% m2 w1 ~' r) W1 a                swarms.buildObjects();6 O9 ~4 k! l8 K) C) C0 z$ \9 u
                swarms.buildActions();
4 C5 ?/ H1 X/ `' p/ n                swarms.activateIn(null).run();
6 @1 P3 k3 x1 E8 u" r- Q( H) w        }( P2 z) N7 t- v; K# Z) f& k8 n$ {
0 y8 H- ~& ]3 x1 N  P
}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|SimulWay 道于仿真   

GMT+8, 2026-9-14 12:12 , Processed in 0.016397 second(s), 15 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表