设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 6795|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑   C5 |( h- v& e6 B: V5 I5 L1 K

7 b) [2 K2 h" j  K+ y本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update213 \( @7 l3 K( m  z1 i
以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.
# w) f& i: w" y5 @5 _9 Zswarm.SignatureNotFoundException
+ n2 e# \( A9 _8 T' ]        at swarm.Selector.<init>(Selector.java:76)
/ v" N- I. _9 b2 I, k        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)0 Z  O( f. l, V0 _( N: o
        at ActionGroupDemo.main(ActionGroupDemo.java:67)
! _6 C& s5 E7 h) m6 Z/ f. A; G
' i, x2 t' ]: \5 H4 E0 b. K: |* E- e8 U0 X5 ]  R. F
import swarm.objectbase.SwarmImpl;
) f- Y' Z5 c% N+ ^/ Q" l: rimport swarm.objectbase.Swarm;6 A  u$ K5 c+ @& W9 J9 m7 m% V
import swarm.activity.ScheduleImpl;; b  [4 |4 t; V& O  f6 `
import swarm.activity.Activity;
0 Y4 c+ v3 W, himport swarm.activity.ActionGroupImpl;9 {/ Z+ `# @0 u% F$ ~" C) L8 q
import swarm.collections.ListImpl;
7 h. j3 j( b4 V$ d: G* Oimport swarm.defobj.Zone;
1 A$ `$ N: M' ]import swarm.Globals;
4 T3 l7 D% @- j1 Pimport swarm.Selector;
( H1 b$ q4 m2 ^0 Z$ c$ pimport swarm.activity.ActionGroup; + s$ j! t1 r) o2 h, L
class Agent {
# z: G+ y' s4 v3 B        char id;
0 t* P. h- p- o: H0 o0 M; }8 u1 J' Q; O" G" a. H, V4 Z
        Agent(char id) {; K* Q0 @7 A% G- y7 D! W
                this.id = id;4 J. H" f+ \/ C* z" Y/ K( ]
        }
: \: o9 h& m  X) E7 v5 e
3 M- H- A2 g* F        public void agentStep() {
& U) @3 M' L2 M7 A3 q! d) E# r8 Z: L                System.out.println(id + ":" + Globals.env.getCurrentTime());; Z5 R# s8 |% Q: U9 m' S; ^* Y) G
        }. r: E0 p6 d8 K$ k* L
}
5 {& R. i8 o: {) c2 a
5 p$ E# N2 i4 a7 T1 m3 l2 O# f& Bpublic class ActionGroupDemo extends SwarmImpl {9 d: S# `% r; C$ q* C
        ScheduleImpl schedule;
9 g: t3 B1 m; P/ w3 S$ N( F  M( }5 c        ActionGroupImpl actionGroup;
, u7 O# y* x; O        ListImpl list;
% V( Z! C% T1 B8 c- m        char Id = 'a';
( A6 s' h: P' P- l1 f/ a( \6 E8 d" Z
" w  n' m9 k. u: b: s9 b        ActionGroupDemo(Zone aZone) {1 @* C* |' T, e6 K8 c$ Z* r$ o
                super(aZone);7 k! Y& n+ o; Z, s; d: _) t& B
                list = new ListImpl(aZone);5 S8 e) ^, U, u
                swarmSetp();% e: Y4 C! ~3 |
                actionGroup = new ActionGroupImpl(aZone);9 E' C1 M; w; n, q$ Z) w
                schedule = new ScheduleImpl(aZone);, H  z& F% Y5 g( Q
                try {5 @% ]& l! l# C
                        Selector agentSel = new Selector(Agent.class, "agentStep", false);
- s% \( ]$ e4 x5 j# ?                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行/ g) n- }( I  M1 d& S0 D
                        
& r  _4 {* S- A* L1 ]( v                        actionGroup.createActionForEach$message(list, agentSel);
  J; m, }$ g) [& h1 o. q) r                        actionGroup.createActionTo$message(this, swarmSel);. _9 z, {* ]; Y
                        schedule.at$createAction(0, actionGroup);
7 Z& d2 ^- i$ G$ I# P- [4 B                        schedule.at$createAction(1, actionGroup);
+ x+ G, B: }' b# ?* s- m- E8 U7 h- z                        schedule.at$createAction(2, actionGroup);
; _/ Y  U# K; ?5 M- i# s% s& n; d- n, z4 J. d' t
                } catch (Exception e) {9 K; }$ c. C) q$ I+ s' }6 J
                        e.printStackTrace(System.err);; X2 v0 ^. ]) v$ l. U/ k
                        //System.out.println(e);
  a. [  j* f  d2 B+ c* r& z' a  J                        System.exit(1);" u6 ?" A; a3 X2 l
                }8 V3 |2 J% x# Y
& O- w  d8 f* k* g& {: P7 A
1 ?. R0 |7 U" `
        }
" R1 s8 _0 f8 n3 G6 J. ^- b2 O' G: ~  W6 m# X  p# K$ M
        private void swarmSetp() {
8 c3 H2 f/ W8 i3 @+ G( I                list.addLast(new Agent(Id));
! \& I3 [, D7 w. \  N                Id++;
% {6 Q8 h* J& v0 Y; Y        }
. K, U3 ]- L1 C3 U+ F$ W! k& I5 y. e' i/ U
        public Activity activateIn(Swarm context) {' o' c3 U1 B0 l  y: z
                super.activateIn(context);
% E/ k$ Y% [1 ~# X                schedule.activateIn(this);
3 W7 x0 D, U0 x* I9 T. j7 g# |                return getActivity();/ l; i8 b0 K9 l) y+ l' W
        }7 ~/ a$ b! L3 F- A/ c+ |7 C6 ~

9 j$ J1 |$ U: i/ A8 U! |        public static void main(String[] args) {2 i  o( K# Q+ j1 C
                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);
- y/ r2 X, S4 V3 m$ t& Q                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);& _, ^' n, g4 z% X, x
                swarms.buildObjects();6 E" S' h. b+ m9 l8 T9 F* f7 d$ y
                swarms.buildActions();
. W$ t3 t2 \6 E. s' j8 O                swarms.activateIn(null).run();, y' d: C; {  [3 j7 B2 Y4 z* ]) h
        }0 W0 H5 I* j4 Q; M& @
5 v% ]' G; e) {
}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-2-9 15:02 , Processed in 0.017323 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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