设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 11851|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑 1 C. }; J) Q. N1 K6 Z! j* U

1 @2 u' n$ y1 f, \2 k; s7 {本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21& x. t0 [+ V0 q' C, l: A6 _
以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.7 R: F# F/ D; ]2 o- l+ [
swarm.SignatureNotFoundException* w5 |: C, {. d8 h8 F' G
        at swarm.Selector.<init>(Selector.java:76): s6 Z% {% U* [% A) N3 T
        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)( ?2 y& S- k6 A0 C$ b
        at ActionGroupDemo.main(ActionGroupDemo.java:67): I5 v9 _% j3 L! S$ f4 g
0 b9 J) u4 G7 p
/ z1 n- u7 a: T$ v% @
import swarm.objectbase.SwarmImpl;4 {2 b: n" W1 n6 d% B
import swarm.objectbase.Swarm;
$ \9 l9 o& w9 q+ x6 D& V1 w* M4 {import swarm.activity.ScheduleImpl;1 n( d9 s* i' s4 V3 h
import swarm.activity.Activity;
* y" n+ h; d" K. r8 ximport swarm.activity.ActionGroupImpl;5 x& A1 P3 a# ~: W
import swarm.collections.ListImpl;
- ]  ~/ o; [; Q: f0 kimport swarm.defobj.Zone;
$ U! r6 t! S$ ^import swarm.Globals;/ M% ?5 k: P- H. o1 E$ \5 G4 ~
import swarm.Selector;
+ b. s* g$ u. K! Q# \2 \8 Zimport swarm.activity.ActionGroup;
; V/ [2 ~6 e' @: cclass Agent {
3 U; o: T$ T6 u* y- L9 Z, [* S        char id;
. V, R  p1 C1 ?) d1 E7 J5 Q! c7 T7 v8 g1 A! @* b0 u* b
        Agent(char id) {
) ^* k" q( S4 u% K3 U9 e" V, L1 ?                this.id = id;3 F" p" ?6 u0 J6 G( H
        }
6 A) p) O) f/ `" y3 h6 S
2 l* f1 n3 C8 ]: t5 `7 p        public void agentStep() {9 ^8 u9 I4 U7 e9 G% f, M5 w9 z) Y* r
                System.out.println(id + ":" + Globals.env.getCurrentTime());+ r. X' H  ?5 I
        }
% s/ |8 J) B! {- k}! O. p3 d3 T, M, J1 @% U; o

9 p, }) Z: F0 S" K1 O+ apublic class ActionGroupDemo extends SwarmImpl {
1 h! Y6 d# L9 I6 [! I3 p        ScheduleImpl schedule;! R. }7 q9 s0 p. f4 w
        ActionGroupImpl actionGroup;7 c( m; n+ Y; M- J; g
        ListImpl list;, A+ L0 w5 b) X) R! h/ X
        char Id = 'a';8 v" I5 J+ l2 V# V
" F' e+ }# f1 p6 n" i
        ActionGroupDemo(Zone aZone) {
& H9 N* K; ]9 ~  O                super(aZone);
& D, R" X/ M3 I2 V                list = new ListImpl(aZone);& u" V2 Q1 i- G$ T8 g" H
                swarmSetp();
/ }9 z; m# T, O  W( @4 S' q5 J                actionGroup = new ActionGroupImpl(aZone);
  C, [4 |: I7 o7 s3 R$ ~  C8 r1 q' ]5 P                schedule = new ScheduleImpl(aZone);
- [# }3 \. l& v1 O                try {- h, M9 N. l5 ]5 D& ~
                        Selector agentSel = new Selector(Agent.class, "agentStep", false);. K- V. M) ]5 N# t
                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行
+ t* {7 j: D5 _                        
  g" g+ n" F' P7 V: ^# y3 V$ B                        actionGroup.createActionForEach$message(list, agentSel);& x% {" n" N% L+ n# F" o  u
                        actionGroup.createActionTo$message(this, swarmSel);
7 i* r; P5 l" E4 Y, i                        schedule.at$createAction(0, actionGroup);
; T$ }5 e6 p) m                        schedule.at$createAction(1, actionGroup);
5 d' d3 U0 R  \: {( a: D& U                        schedule.at$createAction(2, actionGroup);" [& s5 U7 w& t2 o: i  d
6 g- A( I4 r0 N+ A, Q+ V
                } catch (Exception e) {
8 @% |- }9 s0 r; E! B; q6 D                        e.printStackTrace(System.err);
0 b6 G: I! E2 J* n                        //System.out.println(e);& r& N/ V; Q, B/ _. a
                        System.exit(1);; U; K2 r: r. ^6 V4 [" d3 P
                }# {* A4 u2 i" B. k* y
. E3 O; ?0 }" Z3 j0 [- U/ h  e
* s0 p% V# W# O* |% {2 o7 J
        }$ D8 ^5 z8 O# s1 m7 u, e# ^
  o, E* t& s! }& T0 h; o
        private void swarmSetp() {5 i7 t8 I2 }; J! f3 o, f3 k
                list.addLast(new Agent(Id));" d! U8 S1 j: Y" w
                Id++;
8 r  L  i+ z+ D! P$ w* X- I        }
- t: t4 J! A$ S' {1 r) R* p4 w* [4 `7 B4 {, K
        public Activity activateIn(Swarm context) {' E8 _7 a; B7 [
                super.activateIn(context);: |& p2 A! B. x* g) w( u2 t
                schedule.activateIn(this);
5 C+ [4 L: U% j2 P. H                return getActivity();6 X9 x" I  o+ N4 u# J0 I& n
        }
7 R; G3 a: q4 M/ ]
1 g8 l3 r# A- B( G6 Q        public static void main(String[] args) {
5 X1 c+ R! Q* G9 q- K9 x                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);
) m9 f% n  K2 `% n) M( c# ]                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);
5 J, A6 s1 c" _5 H                swarms.buildObjects();! {7 S  ~. |) O. R6 d- V) ^/ m
                swarms.buildActions();
8 D: u1 @' A' E+ _, a  F2 M                swarms.activateIn(null).run();
8 M- \( _) S# f        }( l; a! w, u) ?- ]" S2 V0 t8 i' B
& z( u' p/ V, j6 k
}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-7-23 17:03 , Processed in 0.014710 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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