设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 8500|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑
) \/ E1 \, V$ B/ U; D! ?' n5 b$ r
) |2 N. k0 h" @本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update213 S1 W1 u* c7 C4 n8 S) h/ b
以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.8 V$ k* i/ b  M  k& d
swarm.SignatureNotFoundException
# V1 g$ u; W) Y5 J        at swarm.Selector.<init>(Selector.java:76)
1 ]8 j' O' c! f) ]3 k        at ActionGroupDemo.<init>(ActionGroupDemo.java:37); [/ A8 k  Y7 ~+ C# y, t3 L" w
        at ActionGroupDemo.main(ActionGroupDemo.java:67)3 g, z. }! B  A6 n! o2 V+ p& e  I
( K6 |' `3 P6 S- [+ M: \

2 v! D7 C7 a: M' d7 ximport swarm.objectbase.SwarmImpl;
" C1 w; l% J2 j) O; l, b0 T5 ]import swarm.objectbase.Swarm;% _9 T: i1 J$ N- h- g8 }
import swarm.activity.ScheduleImpl;8 K- X* w1 E; x" r: A
import swarm.activity.Activity;
# _2 A$ |6 H& {  n) p! Z) Uimport swarm.activity.ActionGroupImpl;8 x2 h% `' L0 h2 c) f# j9 b
import swarm.collections.ListImpl;6 e3 O6 ^4 o: Y% p% `7 Y
import swarm.defobj.Zone; : X1 u! _2 F7 f8 h; B5 p& `
import swarm.Globals;
' U  d8 H! }9 u( u: b' t! j% K$ simport swarm.Selector;  f% `5 B2 J$ k( n$ D; B5 q1 a
import swarm.activity.ActionGroup;
; {+ _: P- ^  V+ p0 Rclass Agent {
5 E' |3 \# u; F! C! _        char id;
% O3 s/ S6 K: i% A9 t2 y2 L: o* S# {6 ^4 J
        Agent(char id) {9 o: J) P8 t) J" `0 }
                this.id = id;
0 k" v( H$ P/ j0 O( J4 i        }
0 v- y' b1 N& ]# W) {, ~
, U% W; R+ q3 I6 \( p        public void agentStep() {& {& K0 f: H7 u/ e4 {5 _
                System.out.println(id + ":" + Globals.env.getCurrentTime());
( Z# w5 f* ?! E1 N1 i: l        }
! \, W! A8 o$ w  ]5 `: Z8 }}
; A* [/ N9 }& ]7 e& k0 }
6 @4 d* ]7 @. A9 q! Y( {public class ActionGroupDemo extends SwarmImpl {  a! _6 W4 c! O* v( y+ @  U
        ScheduleImpl schedule;
+ Y; W/ O) ^; s1 k& S        ActionGroupImpl actionGroup;3 B6 p2 Y/ l2 r8 A5 c5 Z
        ListImpl list;
* O& d, Q: G  T1 c) b        char Id = 'a';5 B1 @: w( T/ A6 a9 j6 ^, C9 @4 V

5 M$ G+ {! ^& g* G& G* A/ ^5 w) f        ActionGroupDemo(Zone aZone) {
0 ?5 `0 S, A, l9 d* w                super(aZone);
: G& a! [) K* R- o                list = new ListImpl(aZone);
% \- ~/ M5 ^% E3 A, t2 i7 t                swarmSetp();
9 U+ t" p8 f2 G0 l6 ^/ A: i                actionGroup = new ActionGroupImpl(aZone);5 B: ?( G* [1 V0 T4 Z" z
                schedule = new ScheduleImpl(aZone);- R( ?  i0 i1 j: S2 k4 [
                try {9 d3 E/ _2 t) s6 `
                        Selector agentSel = new Selector(Agent.class, "agentStep", false);1 T" w) _3 S0 M/ u) H- s
                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行
5 I; R& u' [  t1 P2 T' q                        
3 y7 x4 ?8 K7 [& {5 \+ V) q                        actionGroup.createActionForEach$message(list, agentSel);6 `, U$ `/ i5 Z( [8 k- t
                        actionGroup.createActionTo$message(this, swarmSel);, E$ {' R6 B1 W; W- N
                        schedule.at$createAction(0, actionGroup);1 i, {' ?5 H: K; x4 o( j
                        schedule.at$createAction(1, actionGroup);
+ w1 d+ y, ]/ E                        schedule.at$createAction(2, actionGroup);
! S! q# o2 k! A8 M2 K7 F3 C9 M, u6 w; K
                } catch (Exception e) {9 u# U) Q6 l: z3 _
                        e.printStackTrace(System.err);
/ e# A5 j9 ^+ G' B! H' W4 j8 I6 \                        //System.out.println(e);
! _2 m. Z+ i1 m& x8 |) P. Z, {                        System.exit(1);
  a" h5 Q  O- ?2 {7 G  F' a; D                }
& I8 h1 K5 ^& R. r$ h
. x+ m% ^  x+ [! ]7 s, H4 _" G) z7 t* p! `5 l! ]; o
        }6 D" l) q3 E2 g

* h" A# G* d2 X. Y        private void swarmSetp() {4 z/ g$ V6 F; E7 J9 M' n
                list.addLast(new Agent(Id));2 I$ j# ^) E( X7 n
                Id++;
; Z2 R9 {+ k. i5 ~" _9 B9 }        }, T; i# f4 {1 J* j$ K

5 s9 [, E, a; ^! V) v) Q9 W5 k6 [) Y, i        public Activity activateIn(Swarm context) {
! a. f2 K* l9 I1 ]) W) d                super.activateIn(context);
0 b1 l5 o0 g& N4 L$ L! v% \                schedule.activateIn(this);, @! U. t, c) S5 i" u7 T7 _$ E
                return getActivity();
9 o% C. a2 t$ K2 j- l! D        }6 X# b5 s- O" Z( C3 T

2 d( M. }. O  f2 j" W: p7 ~$ U        public static void main(String[] args) {4 w" R/ R: d. d% v8 H- w# c
                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);
  f9 Q+ k# r8 |  D- e. T                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);. V* H1 j* f+ E* N6 X' Z  y) I  W
                swarms.buildObjects();
: z- X+ }4 S4 m                swarms.buildActions();
& K! E8 g+ V; S8 ~. E$ |! ^/ [( B3 @                swarms.activateIn(null).run();
0 f$ z6 H8 x3 F6 ^( e: N- [        }/ Q8 s$ ~' H. v" z
3 o: W% o0 P8 p2 r9 \$ ]
}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-4-14 13:54 , Processed in 0.063402 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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