设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 12599|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑
' N$ U- k! S4 {' @/ P; K! ~( w$ P8 ?+ P) s0 J, v" q
本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21; L. X7 m0 X6 \2 H
以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激." d: E7 m4 U7 p7 Z. R9 j
swarm.SignatureNotFoundException: g/ K: f& ?; B2 z7 j
        at swarm.Selector.<init>(Selector.java:76)# ]2 ^0 O6 T. n! i. n
        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)
% _$ j- l1 D* s- X0 ~, Y% v        at ActionGroupDemo.main(ActionGroupDemo.java:67)
( m; t* k, i$ A# ?9 j2 q( }" a/ f( s
7 s! y) e' u8 I" n
import swarm.objectbase.SwarmImpl;
" r2 u! O, p6 }! A2 ximport swarm.objectbase.Swarm;
. P. L  L& Q' B) {+ G# W0 limport swarm.activity.ScheduleImpl;
# G4 Q9 X6 ^" A3 I; @4 d5 g7 simport swarm.activity.Activity;' @/ k) ]6 V  w8 ~; ~
import swarm.activity.ActionGroupImpl;1 [# O- R7 k# n5 n: M! _
import swarm.collections.ListImpl;/ k/ I5 W- m4 \: D) R
import swarm.defobj.Zone; 1 ]) l  W  [$ Z  Y6 y7 c
import swarm.Globals;
  q# x9 C& g  P* W4 Timport swarm.Selector;, U; v7 c; A1 R8 M
import swarm.activity.ActionGroup;
) M; u- _5 i+ W, |5 G- E' n9 |9 hclass Agent {
, m& L0 v5 T9 q( _3 z        char id;9 h8 \4 d5 t* Q, B
$ z% ~+ w5 f4 M% _4 O' ?2 n
        Agent(char id) {" V# _7 {$ T4 f9 a
                this.id = id;* q& A" }) D6 h$ X
        }
8 ~+ S+ N: [) B: e- r6 w; x+ @6 f0 L: c, l; D
        public void agentStep() {- Y( J0 F1 U1 `# Y. W
                System.out.println(id + ":" + Globals.env.getCurrentTime());
+ `5 M7 d- T% {        }6 D4 e( J4 K( z3 H
}
) B+ |& A  D% l6 i- c, w+ k' Y2 X1 s3 F1 M
public class ActionGroupDemo extends SwarmImpl {: `2 w/ Z: g4 y4 S5 R
        ScheduleImpl schedule;! X! g5 _; B, h* N) t. k: Q! r
        ActionGroupImpl actionGroup;2 @% z4 Q- F* Q% s( ?
        ListImpl list;
  p' x- [9 ]: |+ }. Q# A% n        char Id = 'a';
) T" V0 i( K$ H/ M' ?5 ~' k2 h6 g
2 S/ V0 ^  ^9 `- X+ @7 \, J: J' B8 i        ActionGroupDemo(Zone aZone) {+ B, _2 a4 \* U4 l# |4 y3 u2 c5 w
                super(aZone);
( Z6 m6 }4 |, g# I                list = new ListImpl(aZone);
; A2 f+ j" h+ |. w( y3 c" X                swarmSetp();. ^# }9 }6 g0 ?( `5 T  O  g( l
                actionGroup = new ActionGroupImpl(aZone);' z. }5 T0 K- g5 R3 o$ e8 g
                schedule = new ScheduleImpl(aZone);
' j5 \- c3 b0 s  M                try {# r: h1 L9 |$ J/ I
                        Selector agentSel = new Selector(Agent.class, "agentStep", false);- F( _6 Q& j7 \; W7 ]: R0 f: k
                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行4 V4 v' R( I4 ^! U
                        6 ^1 X5 \8 h+ }& k3 L8 d' b5 y0 t
                        actionGroup.createActionForEach$message(list, agentSel);
2 c4 `  G2 e, F3 }( C+ S$ t4 C                        actionGroup.createActionTo$message(this, swarmSel);; L" ^& ?; M4 D1 K* Y. I1 ^& s
                        schedule.at$createAction(0, actionGroup);
: r# o) E# V) u4 P, X                        schedule.at$createAction(1, actionGroup);# Q6 `& W  x0 F& ^: \  |" o) I% f
                        schedule.at$createAction(2, actionGroup);
; i% ~& t% S/ r
; j5 D1 w5 V0 o4 M5 h4 |/ z3 Q: P                } catch (Exception e) {; H! i( T0 [) N1 S5 W
                        e.printStackTrace(System.err);& }8 d2 J9 |$ D0 v8 k- ?9 Z
                        //System.out.println(e);
; X) d; K$ v! G# n9 `                        System.exit(1);
: c/ h" I/ ^8 d. C                }) z2 g* j4 G3 t# [9 V

: M1 @3 h+ W* q/ Z/ G+ f; i! p$ ^5 X
        }9 k6 K1 ~7 U4 \' x( N! X+ q+ e0 d
; N! m# x1 b8 P% g2 \$ k
        private void swarmSetp() {
$ f& }5 i) k0 d( f( o3 ^                list.addLast(new Agent(Id));+ G& m' |" Z3 g- P( N( N
                Id++;
6 d/ y% V; T9 I* y/ \) a5 b1 K        }9 a4 x2 j, u# r3 _: b% |! X

1 X& {( i5 @. `/ }9 ~  w        public Activity activateIn(Swarm context) {& ]! ~( G, ?, U* @' w6 T
                super.activateIn(context);7 N! `2 b1 C* Y$ U6 E, r5 ]
                schedule.activateIn(this);
0 f$ Z  A$ `: ^' ~                return getActivity();
& B3 j% n" I2 h1 Y9 T        }& H! [6 ^2 I5 B* s, a9 r

; R  C9 g& N0 R  ^& J" a+ R' q        public static void main(String[] args) {
: I. `7 o# c: M1 p0 \6 E4 v* H& L                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);
& Y4 y, q* g( l- C                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);& X9 g8 g& [' L4 l: x. R
                swarms.buildObjects();
8 o$ O5 C8 Y7 h, u2 e1 t" n                swarms.buildActions();8 b2 {5 m- q' [; [) g. w
                swarms.activateIn(null).run();
3 @' u' i  K; I        }5 f/ O6 X& ^4 |& G; T: K

: o$ R; n7 k5 L1 ^- U}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-8-13 09:40 , Processed in 0.046497 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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