设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 12566|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑
& d- T, X5 }  {$ a5 o2 D2 M9 p, ^3 T# a; G+ x8 w
本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update210 l% S7 R: g; V' ?" G4 `$ V; ^
以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.: P, h7 ^* o+ G6 B
swarm.SignatureNotFoundException
& O$ Q/ [- {; H/ E& C        at swarm.Selector.<init>(Selector.java:76): z  B) |6 _4 A# A7 m1 n
        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)
# q  p' R- S! z5 `) Q8 g$ d        at ActionGroupDemo.main(ActionGroupDemo.java:67)% r+ J- b" y7 T6 [" z6 A# Q. R$ Q& ~' x

' i8 S% \7 C1 ?+ D: B! `( i  S" U# D' @
import swarm.objectbase.SwarmImpl;$ B0 V) y8 f0 O9 i: v; `9 u- P7 H
import swarm.objectbase.Swarm;  k, J% L$ S9 l) ^
import swarm.activity.ScheduleImpl;1 i4 ?& F8 q$ y4 T1 a6 q
import swarm.activity.Activity;+ T/ }% B& ^, I; g- @
import swarm.activity.ActionGroupImpl;
4 U3 E7 j6 k) y6 Himport swarm.collections.ListImpl;7 [+ V- v9 y* Z! L, g  V0 G
import swarm.defobj.Zone;
, _/ R1 A; n% e5 S0 c3 m) oimport swarm.Globals;
3 \' i$ W3 t2 u  F" ?. ~( Cimport swarm.Selector;: Y( T) l* t$ w# S: W
import swarm.activity.ActionGroup;
. ^. o( `5 ~. S( O) q) oclass Agent {% T+ [; \6 x" E
        char id;+ J7 I/ r5 l- A
$ d2 Z; r% G6 f$ E0 d" r
        Agent(char id) {
, V2 k4 p- Z6 `) y, }) e                this.id = id;" {) K/ X( n( d
        }
& h. e2 o/ \& j
5 J' F- x* k! Z: |; b        public void agentStep() {- b( c+ q9 w$ k  k4 j+ Q
                System.out.println(id + ":" + Globals.env.getCurrentTime());; m3 K0 n  J- I' Z) ^# P
        }
) P0 B' o3 ]' I5 f}
# ]% r  m2 L$ {; l! ^! j
! `1 X, J8 ~- p% S+ apublic class ActionGroupDemo extends SwarmImpl {
5 ?0 Q6 F5 w; F( t' Q# U        ScheduleImpl schedule;) S0 v9 U( T) M8 d- I4 i. a
        ActionGroupImpl actionGroup;
, ~* ^, l# \8 p6 \        ListImpl list;
; H2 E, Z) q8 F) `        char Id = 'a';
3 I9 Z1 v5 a/ P7 x/ d5 s* o+ S, I" R. @8 w  K' P& c4 l- D) a
        ActionGroupDemo(Zone aZone) {7 f; o* |3 b9 x. m* P9 }
                super(aZone);
, B# m  _2 w; a                list = new ListImpl(aZone);
( \: x0 R- O" n1 ?4 X( H( P, C                swarmSetp();
3 K2 L$ c$ o* n, T# K                actionGroup = new ActionGroupImpl(aZone);# d- L9 [# L  A, u
                schedule = new ScheduleImpl(aZone);
( d: {$ l' K9 S" S$ Q                try {+ r& f/ f7 b" A
                        Selector agentSel = new Selector(Agent.class, "agentStep", false);
9 [' w2 W* _- `; m6 I) b; }( }                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行
: q3 T5 {8 N. v3 |2 A. x, P1 ^: x                        ) R4 V$ ^/ G& B, I! {0 y
                        actionGroup.createActionForEach$message(list, agentSel);
( b8 f( t- O# L                        actionGroup.createActionTo$message(this, swarmSel);
3 g* f+ L" b5 u6 S7 Z8 j; [                        schedule.at$createAction(0, actionGroup);
( O6 G' e* C) t2 v                        schedule.at$createAction(1, actionGroup);
2 s$ G2 z7 }, g4 o                        schedule.at$createAction(2, actionGroup);) v0 P0 U/ N2 x7 a

; ~4 K9 a* t" m                } catch (Exception e) {* ~2 y: D2 S2 w6 z- }
                        e.printStackTrace(System.err);. ]- `9 _) Z7 n3 R$ x. T
                        //System.out.println(e);. K6 p4 Y; {; A3 q
                        System.exit(1);7 |. g! ^' n+ t: Z
                }
" y; V, P3 P' G, \7 W( z' g  r7 ]6 b% j4 d' x) _

4 H% j$ P( H9 f" o. E9 C. e        }/ f, g  r; s5 j& C

0 D5 \: A/ `+ i* e; j! _        private void swarmSetp() {
8 b6 _/ y9 `; g; l5 }0 r* ~5 \                list.addLast(new Agent(Id));0 z3 {2 c: F# Y+ P8 Z
                Id++;% E# a9 e: j& Z; D# q7 x( t7 P/ t+ D
        }# A7 V. }/ L6 Z3 e
1 R4 J" V1 V, n% j5 v, F
        public Activity activateIn(Swarm context) {
% P* d, c" v/ Q- A( S. C                super.activateIn(context);1 e+ {& s# O9 v. ^) c
                schedule.activateIn(this);
; u; G- e- ~3 d3 l                return getActivity();
, r3 Q% f6 q/ A: a        }
5 j. x; n2 T  Z4 L6 w1 I) d
4 i* a& K9 ^4 i! h        public static void main(String[] args) {5 N- G1 F' Y$ b7 _; `- Z7 U
                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);
! _- y8 I0 h- c6 M                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);
& s/ C: Y1 ]$ I& H" y, ?% z                swarms.buildObjects();+ z8 K! d2 q" f/ Y% J- m" B2 z; n
                swarms.buildActions();
1 D6 `. c- A- D5 ~* I  x, d                swarms.activateIn(null).run();6 G0 y$ Z( E( K
        }
, Z" d, s% X2 n8 t7 |9 A4 G- _3 v  _9 S4 l$ R5 w
}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-8-12 11:02 , Processed in 0.017399 second(s), 15 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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