设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 4617|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑
; G: K% g2 E+ B8 U6 i
6 K! g! e5 @1 @5 B, C( o6 Z本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21. D% V# i0 X3 G9 O- w
以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.
/ w' U  J2 s2 J8 @: oswarm.SignatureNotFoundException
% b" f+ X' |( n" I1 ?% ]        at swarm.Selector.<init>(Selector.java:76)
% c. I' O3 W- s8 z  n        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)
- ~3 Y. m: r/ l& I3 `0 Y& G/ F        at ActionGroupDemo.main(ActionGroupDemo.java:67)
# i9 z3 l* m! ?# }6 a5 f: o4 v. p4 s- Y8 |7 Q  N8 ~# y  I

8 M4 w! ?' i( ]5 q4 |import swarm.objectbase.SwarmImpl;7 P: |7 I5 G/ a2 }+ T3 a
import swarm.objectbase.Swarm;; n/ o7 V8 @6 o1 d$ n& U
import swarm.activity.ScheduleImpl;
! r  P. {" l9 t! g3 Oimport swarm.activity.Activity;
; m/ ?8 i, ?5 a. t; d9 y' Yimport swarm.activity.ActionGroupImpl;
- D4 x, I$ m  w) aimport swarm.collections.ListImpl;% i7 Q6 ^6 H7 j3 U( P0 ^" z
import swarm.defobj.Zone; : L0 \* L, P6 u
import swarm.Globals;. V# t! m9 e5 f  P& j3 S& ~
import swarm.Selector;
1 B/ ]. J) V) n6 E2 E/ wimport swarm.activity.ActionGroup; 3 Q6 j6 J. |# C9 ^0 w* J
class Agent {7 o. ]8 _- a8 b" F3 m! V0 s$ ^
        char id;$ s: q9 M) C" ^0 T  q6 x
$ v" ~# g# Z) l0 P$ Z: k
        Agent(char id) {  K8 b8 K$ p. ?; W
                this.id = id;3 y! U* ~0 [* {4 n& D' d+ o6 i0 E
        }" d/ s1 A: x. i& _
# n( U3 p1 ?! d- \
        public void agentStep() {
0 F, x# E& r+ s6 p  F                System.out.println(id + ":" + Globals.env.getCurrentTime());
+ ?1 Z; s( Z% K& h, P        }5 O' N1 r* p$ C  `1 e# A
}& P$ v$ _# G$ o) W7 G$ Y7 A2 O
' l* S' L; _/ c+ ^6 Q) `' x! g
public class ActionGroupDemo extends SwarmImpl {$ ~0 c+ j# l1 t" w; o, ^1 T" }
        ScheduleImpl schedule;5 @" [1 r% R' }: G, r9 S
        ActionGroupImpl actionGroup;
+ o+ m$ J4 D! i# k$ x6 O        ListImpl list;' z  K& i, }$ |7 V! @/ K; [1 x
        char Id = 'a';) q. k, V" x1 L  i4 Y1 J
8 k. |+ U% F- T) s8 S
        ActionGroupDemo(Zone aZone) {
4 w6 w1 m- O- t+ `7 k' E                super(aZone);
9 H% F6 A, w, M: D; `) v                list = new ListImpl(aZone);" ]8 G3 w: G, ]
                swarmSetp();. X) G0 M3 a" ^1 W6 C7 Z6 }* P( [
                actionGroup = new ActionGroupImpl(aZone);' o: B: c1 ^. {/ K4 @* e( Q" u/ U
                schedule = new ScheduleImpl(aZone);
, d. L3 o5 r' m! y4 @                try {; {/ a( N; x/ U, y, K! u! P' s
                        Selector agentSel = new Selector(Agent.class, "agentStep", false);, c7 {  o; P( H- A8 A- T2 C
                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行9 V9 H& B* P3 H- W! V" Z7 e1 R
                        2 h6 V. {6 ]! w$ M" e; k  Y
                        actionGroup.createActionForEach$message(list, agentSel);
" _0 C4 @5 {" C' u                        actionGroup.createActionTo$message(this, swarmSel);/ ?: ]& o9 X7 ]% g8 g6 o! q
                        schedule.at$createAction(0, actionGroup);
7 ~* h0 f: d- S& A" r$ V                        schedule.at$createAction(1, actionGroup);
# F( k& Q0 _8 f, @& c4 h" }" Y$ q                        schedule.at$createAction(2, actionGroup);
, y4 ~) m2 h" U9 T* [
( c; V! u$ l& t6 u5 D: w6 E  \" }                } catch (Exception e) {" [) G. f7 M. @, \
                        e.printStackTrace(System.err);
$ s. g# U) S8 [                        //System.out.println(e);
& E) ~2 k1 \5 s                        System.exit(1);
9 [  H) L2 X# U5 l" `- [8 [                }
6 _) c! U% ]; o7 l, S. a9 w6 H) o; R4 v, Z- O9 k% Z
( N$ \3 v2 P" }
        }7 {2 `- z* x/ g2 g) T% ], I$ ?& y- X
9 \6 D: L! }8 {/ V, Z0 I: g/ V# t
        private void swarmSetp() {* L* k* ]. Y2 _! i) c" i* _  u
                list.addLast(new Agent(Id));
  ]* d8 E$ ^. t% s2 D                Id++;; |# f! v' K3 Q8 ~
        }
9 }3 I% I* z) x* `6 b: l- S+ i9 Y2 u+ {$ t4 l3 I4 q
        public Activity activateIn(Swarm context) {
% v4 u/ Z1 X3 g7 J* b                super.activateIn(context);, G( o, c! Q# l: e) Q: H- I8 h
                schedule.activateIn(this);
( Y. U% R0 l5 f: ]  m$ c                return getActivity();) j: V. K* t$ t- J
        }$ V* r9 w. B% ]$ B# {4 r8 w, U* P
8 d7 g, Q/ o1 Y$ g5 B
        public static void main(String[] args) {
& Y( n0 m  ^8 j3 h' f: `- q                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);
4 b5 M3 z4 F5 J# E* @5 r# ^                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);7 o: f: l# _3 f0 J! A4 \
                swarms.buildObjects();
( y" ^; E+ e1 Z( r5 p) f                swarms.buildActions();" C/ C+ X$ M3 p
                swarms.activateIn(null).run();% `( p( I) ~+ n/ w9 e, q
        }
* G! C1 D5 t; Y( r. Z$ Q- }& a/ k6 g# p0 d7 K/ r7 l
}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-10-16 06:14 , Processed in 0.018807 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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