设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 11715|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑 9 z1 ~  L' g! N- W( d4 @" I
% {) a! D$ U, a
本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21
5 V  C. X- Z& D+ ], D- U6 @; F以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.
4 [6 c1 P$ e& ]5 T  oswarm.SignatureNotFoundException
& G) Y( _% b7 ?" w3 ]9 M3 J5 Q. f        at swarm.Selector.<init>(Selector.java:76)
: n. E% O/ ]; x! q* Z1 e2 z        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)/ A" e, t+ ?4 P( v
        at ActionGroupDemo.main(ActionGroupDemo.java:67)
. W" S# {! E; A2 b2 ^# ^: y. A. _9 z$ y, c
& _( x6 W6 ]' X. L" H* ?
import swarm.objectbase.SwarmImpl;; \- U) z0 ?, S( q3 M! B/ U& |
import swarm.objectbase.Swarm;/ ^$ R# Q( z7 P  j
import swarm.activity.ScheduleImpl;
" q: ?8 P0 i; simport swarm.activity.Activity;9 F1 t! C$ X: W/ ]% \
import swarm.activity.ActionGroupImpl;  f! B, f) L& _: a5 a5 g
import swarm.collections.ListImpl;# j0 w" t2 ^9 w
import swarm.defobj.Zone; - y7 j% k! q* W7 E' f! y
import swarm.Globals;
3 _& {" W- O& i7 ^import swarm.Selector;
7 |& X' m: z0 R' A; uimport swarm.activity.ActionGroup; 4 W( E$ P6 t+ i
class Agent {6 m, A" R+ x6 Z6 }% u
        char id;
$ Z( ]* {+ }8 [3 {2 n9 F
3 O' Y( `% E0 @; B        Agent(char id) {9 K6 @) ?2 O$ T+ R% Q  s" b
                this.id = id;0 u0 p  p4 p& n+ q
        }
& u) u( n. o# ]" [
- j. }3 f3 z: Y7 E6 C        public void agentStep() {. l% u" t& }' |" y+ N  F
                System.out.println(id + ":" + Globals.env.getCurrentTime());& [5 m4 U3 Z! w3 ^& q' }9 t2 P
        }
/ B9 {7 |  k  S6 t+ F3 T* f}; }- F# y3 @3 q0 v

! o  F* l! J. W+ ppublic class ActionGroupDemo extends SwarmImpl {1 K- |6 w. K% @7 |/ ^5 ~
        ScheduleImpl schedule;/ s9 o. e! Y! `* Y
        ActionGroupImpl actionGroup;
4 g6 }$ u/ U$ {. f' X  A7 |+ ~! ^        ListImpl list;3 M: R0 ~* Q& P$ v  N
        char Id = 'a';3 S- w" Z5 i8 S' e: v% p4 h5 K  H( i$ [1 x

% @8 _. I, x: ~2 n+ |        ActionGroupDemo(Zone aZone) {( Z- P6 L3 g1 q& r7 O' \
                super(aZone);, [9 r( ?9 l5 _! d. \
                list = new ListImpl(aZone);
0 f1 C% L' B. V& b2 X; {1 c                swarmSetp();
* {& r: Q+ P4 P1 H- o                actionGroup = new ActionGroupImpl(aZone);. j9 ?& q1 k9 u3 a4 w% ?' y2 s
                schedule = new ScheduleImpl(aZone);" K) \, o( Z/ W
                try {7 l, R5 x% {% q6 ^% X) ~
                        Selector agentSel = new Selector(Agent.class, "agentStep", false);0 W+ Y& f: s3 U; H
                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行
/ J3 o) l4 y7 R% e# t  O: I1 Q( E                        ! L0 {5 }' {& J6 M0 B# c6 Y- M
                        actionGroup.createActionForEach$message(list, agentSel);
. @9 O0 t1 i: t- {2 q                        actionGroup.createActionTo$message(this, swarmSel);6 J( ~) F; d" ~& N) P" z: X
                        schedule.at$createAction(0, actionGroup);
$ r" R( b4 Q  ^                        schedule.at$createAction(1, actionGroup);
/ v- K: F. Y: ^/ r6 I  W                        schedule.at$createAction(2, actionGroup);
( }5 f' h6 ^  [" V
( p2 U: L/ f! y* ?6 p$ G; C                } catch (Exception e) {2 g' s3 f# y+ b* o5 l. o3 i7 k( b
                        e.printStackTrace(System.err);# N- t0 @' ^) `0 N
                        //System.out.println(e);
. L4 U, b4 _; m$ m( s; u                        System.exit(1);
. D6 n. S; a# w                }4 w0 E8 W! S! }. g% a9 I' d

5 \& }+ ^- D! t! y$ b
; g/ A" ]" u/ Y: D$ o        }
1 H% w3 ?9 {$ L! o! F* ~. Q
+ J& s. e7 q" V  Y6 }        private void swarmSetp() {. t8 h& l3 z5 X. n) `- t* Q6 v
                list.addLast(new Agent(Id));
2 q8 n# \4 |) T+ N                Id++;: u( S: E5 X' m$ C4 |
        }- y9 m0 V' X5 A4 r# U% e/ Y( U) n4 j

$ k3 @' h! x% v4 @0 B        public Activity activateIn(Swarm context) {2 d" A, I/ ~( x# T  ~
                super.activateIn(context);
7 A$ w/ k) B/ X8 A7 ^( g1 M                schedule.activateIn(this);
: y- i& [3 U- i. f3 l4 q- o$ b" ]$ Q                return getActivity();
; e; u/ L$ L/ k! n9 f        }
9 B( Z, h% K! c) ]  p
2 s8 d5 R5 a4 Z1 g1 O1 h        public static void main(String[] args) {& t* E/ u# r) j! o4 _5 C
                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);5 G& c7 W9 x9 j1 W2 ~$ F3 `( j5 G
                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);/ |4 n8 z) {8 s1 w; g0 q
                swarms.buildObjects();
: B1 R4 b7 k6 g7 h8 V! |                swarms.buildActions();
% t$ T2 I' O* t# k9 g* o" u+ e- E3 s                swarms.activateIn(null).run();
6 n7 Q$ l8 f- [% Q3 E        }
# P9 c  A- I+ p9 R% |" k7 E1 @% Q, J
! Z0 d( Q# D$ M. f5 ~}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-7-19 21:52 , Processed in 0.017032 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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