设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 6786|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑 0 l" T( c- X" w5 }8 B1 t& b9 P
3 m6 w. [/ z5 x( w) @- ?& P
本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21  v3 a, W, J* w4 O& Z
以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.* Q: v" W1 m+ w/ k. ~
swarm.SignatureNotFoundException
% x; I* w0 }4 ~3 ~. d! Q5 z9 o) o        at swarm.Selector.<init>(Selector.java:76)) b# v- `3 t9 a% ?
        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)
0 ~- L5 A% x  }  f9 Z- B        at ActionGroupDemo.main(ActionGroupDemo.java:67), m  o3 ^; K6 w) S; ^2 A  X

# F! }) V7 J  R& g6 o+ H5 r" Z4 d. g  E4 z' S6 c, `; G
import swarm.objectbase.SwarmImpl;
6 m: x0 d: k) gimport swarm.objectbase.Swarm;
/ \, ?0 q# I- d1 Y! Iimport swarm.activity.ScheduleImpl;1 @5 q6 y* S, V& O. n5 L8 m4 `
import swarm.activity.Activity;
4 H4 i+ i: ?+ E3 t+ ~- x! Mimport swarm.activity.ActionGroupImpl;) p7 U+ n% ~8 |  M/ [
import swarm.collections.ListImpl;
8 z. h4 l) B# u( j' g2 jimport swarm.defobj.Zone; ) |3 T: H* U, G9 B; k, O4 K5 S
import swarm.Globals;
( c5 o+ b7 p) X0 Pimport swarm.Selector;
8 g8 {" C8 _# I$ Dimport swarm.activity.ActionGroup; # \4 o3 @+ I6 j
class Agent {
, [6 H4 }0 q* r7 ^3 H6 R0 t- r        char id;% j' l, I/ M+ x" l6 W6 z5 @' _: L1 L
  f. s8 w* n! O9 P8 I! S2 ]1 B
        Agent(char id) {
8 w  K$ s2 S/ B/ G5 s& z                this.id = id;
9 d* J- Q9 ]6 X! x7 j- ]1 c        }
9 ~0 s% L. L/ r+ F  [7 f% _: u/ T9 {/ i0 L; o: C" H: o
        public void agentStep() {3 G9 f, u+ T! ~+ g- ~5 Y
                System.out.println(id + ":" + Globals.env.getCurrentTime());
7 m8 [1 d& ?' N9 q0 i. A: f) q        }- v* ]! G$ \4 J9 e9 N
}
, b6 G" ?  h2 u8 }
$ C) O9 A% M/ A% e3 l5 Cpublic class ActionGroupDemo extends SwarmImpl {* L: c  P' h7 e+ r' \
        ScheduleImpl schedule;
' O( y  X/ v8 ~1 h        ActionGroupImpl actionGroup;- x* ]0 a1 m5 l- y0 j
        ListImpl list;
) K- [) q/ ^! B        char Id = 'a';  M; K0 i. W" a* D

5 l- b0 Z- H. c: n; j        ActionGroupDemo(Zone aZone) {7 }) E% x8 S: i( \- o1 ~
                super(aZone);4 d% h/ Y$ m: k% ^6 ]- p# b
                list = new ListImpl(aZone);
) n8 o& F7 T6 n                swarmSetp();
. {2 m& @2 Y# V9 U4 z                actionGroup = new ActionGroupImpl(aZone);, G+ I3 ~# _1 K0 N1 B
                schedule = new ScheduleImpl(aZone);* W4 a7 H6 d4 `, @' w
                try {
* m% W! z* y1 h4 i                        Selector agentSel = new Selector(Agent.class, "agentStep", false);8 t! G9 i( B; V- _- @4 x
                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行- i3 ?" ]8 Z" v6 V' l( N
                        
$ q0 G: x  y& m* j+ ]                        actionGroup.createActionForEach$message(list, agentSel);& L/ V1 A: {+ `7 F2 T% s
                        actionGroup.createActionTo$message(this, swarmSel);2 t& @9 W" d* k* l0 t! M( a
                        schedule.at$createAction(0, actionGroup);
9 s( i3 A% y% p* c, A                        schedule.at$createAction(1, actionGroup);
. \5 G6 q) r2 M                        schedule.at$createAction(2, actionGroup);# i: i0 N( ]4 r8 n
& G/ c$ R8 S3 N$ w
                } catch (Exception e) {
0 J: b; [( b5 e' C. h# P                        e.printStackTrace(System.err);
! p5 s  P6 N! g& x! }                        //System.out.println(e);( [! \/ W9 n7 G) Z6 [8 o. q/ Z
                        System.exit(1);+ \% Y/ s$ g  _0 L7 ]
                }! Y( O% F. l7 a7 @5 a/ }

- ~2 {4 g% r1 c1 P& `  w7 i
, e( W, O: l$ ]( i  o' U/ k( J        }
5 k% ~- B! I/ C! E9 Q+ x" t7 L/ ?$ w" ^6 H
        private void swarmSetp() {
. {# a1 g+ s" _- [2 W- ~* u- B* v& {                list.addLast(new Agent(Id));, Y4 D' q  w" y6 h+ m
                Id++;
5 m/ {) q/ B# Q& n        }. C1 p) i( Q: C9 K3 {% _9 i5 y. O: H
! _- k0 r6 e, x
        public Activity activateIn(Swarm context) {
* J3 P) a' Y1 r7 u0 t                super.activateIn(context);5 u( I+ U) l; H) S0 V
                schedule.activateIn(this);
& _1 D6 a. y8 r. E                return getActivity();
) i" h7 f+ L/ M8 u, b2 ^/ [! Y        }
9 [7 S# r- \! a* b# Y" Q" S% ?. X/ v2 ]$ x1 ^
        public static void main(String[] args) {3 ~6 \& ^- K# i7 X) Y4 U
                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);, M8 l8 D& a9 }) S8 O' A) g: k
                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);- _; V, X. ^. w/ l
                swarms.buildObjects();
5 ?: Q6 B1 z. k# o  {                swarms.buildActions();
" _5 B5 f" @$ u7 x3 g                swarms.activateIn(null).run();
! l  T# ^; m0 [" z0 f  ^1 p        }  h0 E& N* b( G% @. t; a

! k/ v6 @8 w4 W}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-2-9 07:50 , Processed in 0.016850 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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