设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 10392|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑 ! r) k6 x) G4 J( _$ z
! s6 f! i/ J4 m; z8 P4 J
本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update214 J* w' x) A0 Y; @4 ], D$ R3 u0 @( D
以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.
! a; n7 o  w' E, B" \8 Hswarm.SignatureNotFoundException; G3 B6 m* B: T0 U* `
        at swarm.Selector.<init>(Selector.java:76)( O) W, ]9 P8 `# ^2 ?
        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)+ _, O7 {1 x$ u5 O, l9 f7 c# r9 C
        at ActionGroupDemo.main(ActionGroupDemo.java:67)
8 I3 v' z5 H; M/ g3 f. N: m4 w; S( A6 {8 e& `. ?! {7 {

" K7 r2 ]6 P- Z/ Yimport swarm.objectbase.SwarmImpl;& d5 ?9 y! j" S$ Z1 Q% ~
import swarm.objectbase.Swarm;( {% ^( P( j4 v' s# X* p
import swarm.activity.ScheduleImpl;
4 ^7 w4 U& e* n5 R2 @: G- P) oimport swarm.activity.Activity;) O4 q( A: J, Y5 Y! A7 u& Q, e
import swarm.activity.ActionGroupImpl;
4 k- x  l3 E% o- u4 Oimport swarm.collections.ListImpl;( Z! t" r! A7 ^% ?8 Y; H
import swarm.defobj.Zone; 2 }5 j7 @0 R0 J3 w$ X
import swarm.Globals;* Y) M9 ?+ K( b1 I' M9 b
import swarm.Selector;) U' m2 w' D/ _, H2 p( y9 M
import swarm.activity.ActionGroup;
* k: s# g/ l9 K0 I4 C& B8 |class Agent {
  w+ C# `* M7 e7 k" T' `; ~        char id;
2 N  _4 k9 A, j" o3 @0 P% V6 i3 p% \+ B  h4 `+ S7 k3 M2 f" [/ w
        Agent(char id) {
/ B. r( O' u8 e+ i/ o3 T( s                this.id = id;8 }. s$ B' b4 y# q: z) z7 _4 b
        }
% J! y; ?, z% b8 M/ e: e2 R' m& h+ s
        public void agentStep() {4 d6 p; m: B7 z+ ~, n# z4 G3 `# N
                System.out.println(id + ":" + Globals.env.getCurrentTime());7 _: u2 [' Q" c2 S# z$ }( m
        }
  V( u- ~& d8 T}
( p) ]/ d# b- @4 Y2 n  @4 o# \/ O" V0 A
public class ActionGroupDemo extends SwarmImpl {: V/ g6 B. @6 w1 W
        ScheduleImpl schedule;$ @" _4 K& v- l% O
        ActionGroupImpl actionGroup;
! m) x- w; ^' |, a9 C        ListImpl list;2 ~1 P) E' M0 }8 L6 d  B
        char Id = 'a';
5 H& j, Q2 S! o9 ?7 C/ n, Q
9 a8 l; V$ y/ Y5 K$ G* c3 d; p        ActionGroupDemo(Zone aZone) {8 _/ Z# ]7 h+ o% T" I
                super(aZone);3 E' t) V2 T5 Z4 J% U2 q8 b
                list = new ListImpl(aZone);
9 q, `: x4 R) s, Y                swarmSetp();
* V9 _& }, S* e2 I0 o) f9 J, I                actionGroup = new ActionGroupImpl(aZone);
" `9 i* u/ Y" E# Z                schedule = new ScheduleImpl(aZone);7 y& _: e. y& ?/ N# g, h( a6 N" U: _# H
                try {$ J# e7 u" v4 W
                        Selector agentSel = new Selector(Agent.class, "agentStep", false);
6 S! v. H. \1 c7 h! }0 \                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行! F  T$ a$ G( `* t, K% \+ a
                        ; n5 ~% T' T3 ?$ h  t
                        actionGroup.createActionForEach$message(list, agentSel);) A  \5 m; S" I$ s, J
                        actionGroup.createActionTo$message(this, swarmSel);7 c! d4 a* z, `8 }% ~$ L
                        schedule.at$createAction(0, actionGroup);
) R+ u, R) f9 l. ?% c1 t                        schedule.at$createAction(1, actionGroup);: Z" Y/ Q! F6 Q/ M% i$ c
                        schedule.at$createAction(2, actionGroup);
9 T  ]: U) J) h4 ^3 K' }+ V
+ @7 |/ n9 ]+ ?% G1 Y                } catch (Exception e) {
$ Q, N9 V% E: X; c9 U$ [. v                        e.printStackTrace(System.err);
4 _5 O+ f: l% T. V' E, v+ H2 `                        //System.out.println(e);0 ^3 p& K7 ~0 O& w
                        System.exit(1);
- s* J: e' `- d2 G9 r                }
4 k/ @# _, T8 b4 \: I, ^
/ T% `; i) O8 _1 Z- d' ?8 \; }: ~$ C4 @/ g" Z0 r3 |  q* o
        }
" N% |$ G( R& j# G, M" t' x8 c9 [) x+ B! m
        private void swarmSetp() {# Y1 d$ q2 N0 M" A' l0 Q4 L6 F
                list.addLast(new Agent(Id));
) R  M4 [$ T' W0 S) S* H* J                Id++;! G( q- U; n, c! G9 Z2 [
        }
3 a# w5 p) d! k+ K5 N7 s4 b; R, S/ _4 e. G
        public Activity activateIn(Swarm context) {7 }& T' d8 O& A1 o- V4 V  X
                super.activateIn(context);4 W5 Z& f+ Y# F0 O+ p3 Z
                schedule.activateIn(this);
7 a, J+ G% z$ \9 x                return getActivity();
% v+ v4 H! F. _+ }. n6 q1 }        }" h+ S$ _- f, a' @% {& [

* A1 J' K, ?% B8 O* g        public static void main(String[] args) {
9 E( A9 X. U1 y1 Q                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);- G* S9 G/ D* r! e
                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);
  m4 p% \- I7 e+ f                swarms.buildObjects();7 B- O- k" F! B, M3 B- g
                swarms.buildActions();' h; o& D  x) v+ p
                swarms.activateIn(null).run();, e3 T0 L- u, I1 [4 c
        }1 Y8 n3 J; h6 k* x# h

% Z# u7 g9 n& a2 A}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-6-12 23:57 , Processed in 0.014446 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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