设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 10634|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑
9 Z; l4 B- u8 U- a9 Y
5 D; D1 g! G' m2 w本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21# K. i5 ^$ P/ O2 c6 P1 ~0 X
以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.
, m& e% m( z' |: d2 L. C, x! Q6 Bswarm.SignatureNotFoundException: _# U4 g4 h- r" K
        at swarm.Selector.<init>(Selector.java:76)( V2 r" e2 D' ^' l+ w3 X' I5 A8 }
        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)
% c& R* k! D, F0 Y7 ]5 H        at ActionGroupDemo.main(ActionGroupDemo.java:67)7 ~4 ~1 d: |9 j) K1 C: x0 K5 _* S, c

% \1 f1 R+ Y$ c3 g- Y2 ]6 F$ C& O4 M' ^' y/ I2 r% i: h& ?
import swarm.objectbase.SwarmImpl;6 o! r5 s# \8 p4 c
import swarm.objectbase.Swarm;! D; p4 e& c( s& U
import swarm.activity.ScheduleImpl;
2 q% r' d# l9 ]" ?/ N4 Eimport swarm.activity.Activity;( e- y0 J* V% y: c/ E( _( d" }
import swarm.activity.ActionGroupImpl;; M7 e- R/ X3 N- O
import swarm.collections.ListImpl;
2 W/ E' d- U: m) [import swarm.defobj.Zone;
2 w. a+ u2 Y2 r; Z: q+ I+ E' q/ Oimport swarm.Globals;
& Y+ `) \( [! i2 `2 J: s; G- }+ eimport swarm.Selector;
2 a# ]4 I/ L0 A) Eimport swarm.activity.ActionGroup;
2 B1 J5 o7 [) G. dclass Agent {! j4 u1 a9 S1 G8 S
        char id;! o+ @* ?' ?+ K( v+ a& g. ?

+ W5 y5 T: ], o" ]- C        Agent(char id) {
* f# b# |* X+ x9 B) _+ W. c                this.id = id;
# p+ \' p! A; Q        }4 B# ~. K/ h1 N; q2 W8 s
& a6 b4 C, S( [: Z% M
        public void agentStep() {
' I0 ~5 E: A* E& C7 Q+ \                System.out.println(id + ":" + Globals.env.getCurrentTime());
/ c% ?- x7 q) D) u1 d+ A: _        }
9 O' V/ u0 I( Z) ^}
5 h, u/ t. N) r
9 |( K" d- ]* b: i" i( k$ Hpublic class ActionGroupDemo extends SwarmImpl {" r) z) S7 @  P5 o2 M
        ScheduleImpl schedule;
9 N6 x6 J- {  A0 Z$ D        ActionGroupImpl actionGroup;! _$ q: V3 A* T4 ?3 R- \
        ListImpl list;
! Y1 c: T5 c& p8 x        char Id = 'a';6 V+ j- M% Q$ ?7 h! S
/ `  D9 V/ _, J# }" Y  A
        ActionGroupDemo(Zone aZone) {- c9 Y: B  U, |7 x) I' l& L
                super(aZone);
! N! ?3 e+ l) u                list = new ListImpl(aZone);2 x4 u4 j* K- p, q6 e4 J* j% x
                swarmSetp();
1 H  w$ {8 N2 ~0 ?! t! V9 A1 {                actionGroup = new ActionGroupImpl(aZone);
# N# @; ^9 q  U                schedule = new ScheduleImpl(aZone);
" s# H. q- q- ~8 z                try {
9 `, e( _$ B8 ?                        Selector agentSel = new Selector(Agent.class, "agentStep", false);
# A7 x- |; B  W) [4 l: v- d                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行
! o2 f2 i, @% ^/ X3 _8 v5 K' ~/ j                        " a6 ^. P3 {8 s
                        actionGroup.createActionForEach$message(list, agentSel);3 Z: @: _, G! z( k! h9 z! j
                        actionGroup.createActionTo$message(this, swarmSel);+ n+ h' A+ n& C( z: }' d0 C5 z
                        schedule.at$createAction(0, actionGroup);. Z5 j7 W& f- u& k  C- P) g
                        schedule.at$createAction(1, actionGroup);" V- ?9 f3 c3 B6 L
                        schedule.at$createAction(2, actionGroup);0 }) L! A0 `/ k3 x9 P, t9 ^; I
! U" z& d1 w; X4 {% t6 t1 `
                } catch (Exception e) {
# X! ^8 I- K* q# V, P4 }$ r                        e.printStackTrace(System.err);
+ K; L' F; h. ]: \. E  x9 f# l                        //System.out.println(e);
' n$ P3 U0 @. h8 J: C4 v5 I3 [                        System.exit(1);+ I  y. |7 T- g6 [0 `
                }4 L+ W& d" @/ Q
  `9 q0 X, V* ?8 p7 g

( z# Q( `2 ~3 s8 w$ ^* D4 E# E        }; k4 a3 d" l4 A; O
, j; |- b& @. W3 B
        private void swarmSetp() {
4 M! O: x! v2 f$ _  Z" B                list.addLast(new Agent(Id));9 x( v$ X0 D8 t& o' u& ^% Z
                Id++;& ~/ ?$ ]  P+ B9 A! V% j( @! d
        }
0 \# J, [5 j: t- w
! B3 m2 f, _6 t0 G        public Activity activateIn(Swarm context) {
5 s( A0 o4 U* i6 I3 p                super.activateIn(context);7 N. i& U- u8 x  x4 P
                schedule.activateIn(this);6 C( j6 t+ h( j1 B5 w1 m# o6 F& g
                return getActivity();
% D; a% L* C+ w8 O3 \; G4 d        }
2 |7 t! p7 y! @- _. f
$ E4 p& r; h" @. E        public static void main(String[] args) {
! A$ v# F/ Q! R; {                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);" D& I: ^6 n- n: k, M2 n6 G* U
                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);9 i9 m- U- J- \' d
                swarms.buildObjects();" w- ?% ^6 S& m1 s& j* `# ^- E
                swarms.buildActions();1 q  t8 u5 }( w0 Y5 b4 S7 e' J
                swarms.activateIn(null).run();) K7 s5 G, T; j1 {0 `
        }' w9 ]& b% \  G/ x5 k
' x% h* E" w- E& |5 ^& u! g
}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-6-19 03:43 , Processed in 0.013886 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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