设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 12678|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑 7 p7 E8 [0 X; K8 E' M0 J3 Y; Y9 I
6 k+ h# z+ i! G- w9 [5 G
本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21
8 \6 l7 k" G# S8 |3 ^8 a以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.
1 d8 Q8 s8 v" H& m4 Mswarm.SignatureNotFoundException. F9 |1 g$ J) n% B& @9 L
        at swarm.Selector.<init>(Selector.java:76)9 R8 c/ P8 X, I; e: k5 H
        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)
9 }; B/ Y1 {9 Y% N2 }" @: I- t        at ActionGroupDemo.main(ActionGroupDemo.java:67)# c9 B% s' D+ O# E
7 l) _; w% X" |% {* k' s4 [

( `+ Q/ i/ d5 [4 X) U% }0 a) s" Aimport swarm.objectbase.SwarmImpl;; |* }, p: [* _
import swarm.objectbase.Swarm;5 p* @9 c# U9 G# E& x4 R
import swarm.activity.ScheduleImpl;
; K+ X# h( K, p7 B7 [3 ?9 ?$ Y7 e+ limport swarm.activity.Activity;$ W7 I$ K, Z$ O
import swarm.activity.ActionGroupImpl;; D5 _9 G# |4 Q3 s& K# B: O: p" a2 P
import swarm.collections.ListImpl;
, S( T, W. g  @1 h; S5 U  j; @5 Ximport swarm.defobj.Zone; & Y, N7 r# n0 C) l( S: D
import swarm.Globals;
/ D5 h' u. ~& W4 pimport swarm.Selector;. M& v7 S" R4 o4 G% d/ k6 b8 i
import swarm.activity.ActionGroup;
9 S1 R6 l( z0 A" G6 e+ I' ]class Agent {
0 R' R5 [/ f; O/ R( u# D" i0 i        char id;, X4 K/ E  n! Y, ]3 F! Z$ j
- e+ K% G# b: z; a( D8 j
        Agent(char id) {
: T" d$ z& X# r7 W7 z! O                this.id = id;  M; J. Y' S& I) l0 Q3 Y
        }
& H+ C6 L) y; v2 P% j3 o
0 E' o5 c' {6 |- i, T6 ~6 Z, y# x        public void agentStep() {7 v; Y! Y8 `$ L8 ]( g
                System.out.println(id + ":" + Globals.env.getCurrentTime());
2 w# d1 k+ c" K/ {        }
& G( P$ @" w0 K0 h0 d}
7 }" C' E' H' i* ^* n+ Z8 h
- z: H/ E4 J. Q9 q1 X3 |public class ActionGroupDemo extends SwarmImpl {
, u& I& W+ T2 R* R. F# O        ScheduleImpl schedule;
* _6 G# r0 L# d/ n' V        ActionGroupImpl actionGroup;
: V# ~  M' h: _; d1 Q$ E5 f        ListImpl list;
# K2 Z5 i3 f2 |1 n4 P) K, F8 `        char Id = 'a';7 H" s+ o0 m$ c( G+ p' z) H
( `* T+ ~) t: t: G) ]' t7 \
        ActionGroupDemo(Zone aZone) {
+ N% v1 P4 i3 t% y% W                super(aZone);/ l. o0 h& C; d, l- ^
                list = new ListImpl(aZone);
$ J8 O8 y% j" {% Z                swarmSetp();
' C, l( L0 {9 m, |$ d% C0 s# j                actionGroup = new ActionGroupImpl(aZone);
" i+ V. ~' e1 r! l                schedule = new ScheduleImpl(aZone);) Q8 B  q  Q. M7 Q
                try {
* I2 ?- m0 c( w* w4 T7 P                        Selector agentSel = new Selector(Agent.class, "agentStep", false);; ?1 Z- J/ E6 B
                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行: `: \% F0 s! f9 B
                        
9 l& p. S  g( W" P5 G' W                        actionGroup.createActionForEach$message(list, agentSel);/ J: i, A$ x6 O
                        actionGroup.createActionTo$message(this, swarmSel);2 u3 w0 K& Z: E
                        schedule.at$createAction(0, actionGroup);
9 a: S) ?, ]+ {' ]9 {& T                        schedule.at$createAction(1, actionGroup);
" y" H. n; X, x* n4 j6 O- `                        schedule.at$createAction(2, actionGroup);
4 B. M: y7 Z! W" w7 S
, E! }9 m) h: ]- H, _- r                } catch (Exception e) {
8 O2 l9 Q! F% T1 N8 Y+ c2 K                        e.printStackTrace(System.err);
# q2 E* a9 I# L% s                        //System.out.println(e);5 X+ {! y$ @" w  k& r: m3 V+ V# l
                        System.exit(1);7 c& x6 B, z# f! g& h8 E
                }
+ ?$ k4 `4 P$ P' k- ~1 j9 `/ y3 C8 I6 {* L5 {( w8 I; ?5 k

8 A$ ]- O1 Z8 c; `# V        }
9 x0 K; p0 {- E" y% _, j1 B* |5 c3 N5 t$ t  M- F1 Z' N0 l
        private void swarmSetp() {
, y2 L, p& l4 b                list.addLast(new Agent(Id));
% s6 @; f' N- ]6 j                Id++;, o+ ]$ ^. A$ j) q1 Z' e1 Z! l! e
        }- I! T0 H; O1 T3 y6 E6 C2 Q* ~

8 f1 i; b8 O6 Z& \  K4 z        public Activity activateIn(Swarm context) {0 s, g0 Z# o  Q
                super.activateIn(context);
, |- x6 O/ ]3 W6 S                schedule.activateIn(this);+ J6 {9 B6 `/ R
                return getActivity();+ ~$ H1 b$ ^' E0 d+ W
        }
# v) \: V/ b9 ^. o2 e3 T) d! G
! [* [5 p5 ~5 N2 T0 J! B        public static void main(String[] args) {- d) @0 N7 s0 _0 L: i6 i5 v$ b1 N4 A7 a
                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);$ j; C" N( |- S/ r5 I2 q
                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);" ^" L3 F& r. V4 ]5 [# e% r
                swarms.buildObjects();
6 V+ Y) T- U# c. ~1 |6 T" ^; b                swarms.buildActions();: X& T3 q2 I0 B' \1 n
                swarms.activateIn(null).run();" O" b: l4 j3 `- F, s! {! D
        }/ E- U4 t- \5 n% |
% A/ v  W9 |3 ^$ V
}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-8-15 20:01 , Processed in 0.016445 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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