设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 9824|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑 " p) L! `3 y+ f* u2 |* x* F3 O: L$ ?

/ a& z; h: g6 Q- m4 N) ^9 `# R本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update218 a- c2 s, P' K  Y8 v$ f
以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.
4 N2 w7 X$ T9 xswarm.SignatureNotFoundException
' n. ~- c1 o3 |$ H& v        at swarm.Selector.<init>(Selector.java:76)
1 h0 Q% l* u& U7 D# W        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)
3 d2 z& r, I/ [* H5 O( F        at ActionGroupDemo.main(ActionGroupDemo.java:67)" C2 R, I! ?0 R" Q, |8 ~2 Y* j
" O: w' {3 Z5 i' h+ F
7 D" |5 ?! j* X) L( m
import swarm.objectbase.SwarmImpl;
/ }  i8 W  w& K3 f& M% uimport swarm.objectbase.Swarm;  w+ M" _- ?8 w* E# u* [- c1 m
import swarm.activity.ScheduleImpl;7 M5 L" H8 S& d& h
import swarm.activity.Activity;
( W7 Z6 k0 {) d9 g/ n0 w. K. Yimport swarm.activity.ActionGroupImpl;
+ L7 m7 n" I; o9 f1 t- @, rimport swarm.collections.ListImpl;
+ M# H  U7 O! f( L( `  dimport swarm.defobj.Zone; 1 D$ {$ L  s/ P* i# D
import swarm.Globals;9 X5 n3 m# N$ E0 ]4 L; ?
import swarm.Selector;
" R( F/ p  }. g* b. `/ g9 |9 pimport swarm.activity.ActionGroup;
3 ~  D$ A+ p0 Y0 p4 M( `# ?$ sclass Agent {
. N6 n# e6 j* [7 v        char id;5 f* [: T' ]0 W5 _. |

1 Q  ^0 B! g; c1 Z        Agent(char id) {: _- f" n- ?7 |6 C3 i
                this.id = id;& I5 |4 ~5 `" A; d7 z
        }4 _3 f. {% R- X/ @8 X
8 U  k: n" e1 o/ c
        public void agentStep() {
" T4 [  B& j9 C2 X+ M                System.out.println(id + ":" + Globals.env.getCurrentTime());
; K% }2 t! N9 g2 J; H5 {! H& A        }
- d' m9 n$ g+ |* D- q}' S! C* q8 \( s
) a7 P4 D* r" F( }4 P: G( L
public class ActionGroupDemo extends SwarmImpl {5 H/ @1 o/ u' h  {
        ScheduleImpl schedule;7 J; |* P5 ^$ V* u- Y
        ActionGroupImpl actionGroup;5 f+ m( w* O: b5 Z4 a& d
        ListImpl list;4 e/ v7 e7 h) H% j3 o* N
        char Id = 'a';$ t9 h/ ^/ e" f

9 L5 c) ~' `0 `  g7 ?, ]        ActionGroupDemo(Zone aZone) {7 e/ S( C* U7 m# B( V4 a& S+ M
                super(aZone);/ A$ o7 g  G% C  X0 [
                list = new ListImpl(aZone);
$ c1 v; X( m0 X( s( Y                swarmSetp();$ F/ N- Q1 _: E% Y% x
                actionGroup = new ActionGroupImpl(aZone);5 n8 [7 @& J, r
                schedule = new ScheduleImpl(aZone);
; `: t0 u5 c) N3 W8 `                try {
) ~- w. k6 r, T: N: E; a                        Selector agentSel = new Selector(Agent.class, "agentStep", false);; w: q  E. P' T; i# d4 G! [3 l. b
                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行/ e! h* ]1 N' T: c$ d
                        6 ]* M. f: K+ k8 P! O: c; c7 H1 P
                        actionGroup.createActionForEach$message(list, agentSel);
. O1 T0 A9 y5 e# H' F                        actionGroup.createActionTo$message(this, swarmSel);
. L( j- ^' G( p2 v; S                        schedule.at$createAction(0, actionGroup);
- B3 R% S7 b# e0 D. P4 `2 R5 A" A" [! p                        schedule.at$createAction(1, actionGroup);
" ?( M  {6 c: p& G                        schedule.at$createAction(2, actionGroup);
0 Y0 `5 x; b/ `. M' {& G% g
! q9 i. `1 M4 ]. H, S4 U                } catch (Exception e) {
) k- L* j9 u) ?! x7 y5 x) E5 e5 |- b                        e.printStackTrace(System.err);
. E, y- }3 D, a                        //System.out.println(e);8 a; J- D6 @/ x/ S8 ~1 H' L1 C# z/ F
                        System.exit(1);
, W3 K# f. u* [8 U6 J                }
7 H' ]0 ], a! l- \& i9 w/ I3 i7 d

3 w: O! b. |8 O+ u5 a% |% }        }
2 H+ V8 d1 V4 \  F0 h
' F) K; `9 s0 ~        private void swarmSetp() {$ m+ n0 @& C" {* D
                list.addLast(new Agent(Id));
) M, s7 p( G! _; F. w% S                Id++;5 Z8 x. |# E! d
        }3 e2 _; h* C* y; f- F
# V4 Q8 b; N- m: P8 j
        public Activity activateIn(Swarm context) {
0 k$ F6 N' C0 u                super.activateIn(context);
& _' ?9 _0 e% u* a- p6 C2 i                schedule.activateIn(this);2 l! k+ X2 L: B/ U
                return getActivity();# w6 O/ n, u3 f$ \( T. Z
        }
3 }' V% T/ s0 B5 a
0 l& ^" _1 A. c8 m        public static void main(String[] args) {6 X- c- z. q* r! Z8 t) l
                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);) {8 ?, A. X! D' B- ^
                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);* n& ?0 D) p. g5 e: e; k
                swarms.buildObjects();
' j+ l5 ^+ ~+ p+ d  y                swarms.buildActions();1 O% ]) B2 L! B9 L" K+ W* }" S
                swarms.activateIn(null).run();, G2 C6 y$ e, o8 a2 t) B9 f- d2 b
        }
$ o; j& D: Q( x. J) X9 r+ h$ K# X2 _, r+ b
}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-5-24 10:30 , Processed in 0.014075 second(s), 15 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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