设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 7302|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑 ' L" v8 x) Q4 p: o( }5 C

+ M! Q+ N5 v) r0 w: u本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21
! Y, {9 Z3 c( F以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.# D& d7 j5 z: r, M
swarm.SignatureNotFoundException
1 [  e/ W- ~6 b" C        at swarm.Selector.<init>(Selector.java:76)1 i* K6 W% d2 d
        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)  Y6 H1 f4 r6 V7 e: a+ j
        at ActionGroupDemo.main(ActionGroupDemo.java:67)
/ R; q( o: O4 F3 c4 [. Y8 C3 s
' c0 _' N' f  Y2 T$ r( h0 y4 i) h3 S3 U
import swarm.objectbase.SwarmImpl;
% M, A0 n5 `3 s, Limport swarm.objectbase.Swarm;% f' X6 x3 r5 Z6 S
import swarm.activity.ScheduleImpl;
3 S% c0 F7 P. R: @* bimport swarm.activity.Activity;
3 {% N  O( ]& L: _9 {import swarm.activity.ActionGroupImpl;0 F% \) R6 H# f4 I2 k
import swarm.collections.ListImpl;
; Y+ B7 o1 b2 f7 i  K! l6 L( ]import swarm.defobj.Zone; 2 n0 s2 x/ R4 b% q
import swarm.Globals;$ O  d3 y+ D# j7 R; Z6 r$ i
import swarm.Selector;0 v4 l6 X$ e1 Q0 I8 k
import swarm.activity.ActionGroup;
: _' e  h0 h" Z9 ~' O  G9 sclass Agent {
/ R3 |* I2 l$ J3 {" C& w+ }* W! S  |        char id;+ L8 ?( t+ \( h; T. o* T/ \% [, W

/ W6 L( J, u* b$ b: O8 ^0 l        Agent(char id) {
- o- c9 s; A* M                this.id = id;
" p7 p( n- }- v7 O        }- V) K  S( k& T0 `& ]

* v% n" n( v* O1 S/ B5 X+ p# f0 {        public void agentStep() {7 C/ K+ h$ g4 ]5 O: X4 f$ E
                System.out.println(id + ":" + Globals.env.getCurrentTime());1 }: g/ U: }6 l' L( C4 D# J' F
        }# s6 I, }3 I, m) K: g$ z# b
}
5 D6 D  _- W' \& l+ x$ @8 I9 P. }  W: f% }  }0 c, ]6 {% r( n
public class ActionGroupDemo extends SwarmImpl {
! n/ v+ ^8 m3 x/ g3 m        ScheduleImpl schedule;
6 V0 A4 [" r! u        ActionGroupImpl actionGroup;
2 H- h+ y& b$ Z+ h* ^" J# |        ListImpl list;
* X! Y$ o( [* ~        char Id = 'a';
) W- |  w/ x* R' f# V' i! f
* \1 _4 Y3 l7 T  E6 m7 R6 k- P# j        ActionGroupDemo(Zone aZone) {: @: A3 a# z  T  `
                super(aZone);2 b! M6 F& r1 X9 g
                list = new ListImpl(aZone);
$ s7 v( |* ^' x. k& _                swarmSetp();
; o2 B* A5 O5 r0 y8 U                actionGroup = new ActionGroupImpl(aZone);
8 K( S  i/ y' S  V) r' f                schedule = new ScheduleImpl(aZone);  O( k: }0 K+ i8 u& M# e- ?
                try {- e: u, [$ i& _% U$ b+ J% y7 G, ~
                        Selector agentSel = new Selector(Agent.class, "agentStep", false);
6 o+ z& v7 S" {9 Q! Z( a) W                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行
) X) z% @; K- A# {                        5 _: w; h- z2 t; @
                        actionGroup.createActionForEach$message(list, agentSel);
1 T) E2 U2 P+ z. d6 f                        actionGroup.createActionTo$message(this, swarmSel);
& ~1 B4 v" b6 j8 _% Y! f& E                        schedule.at$createAction(0, actionGroup);
& F& L4 x3 h4 S                        schedule.at$createAction(1, actionGroup);% t% P# q. J% [: I5 a6 @
                        schedule.at$createAction(2, actionGroup);$ @' y4 N* D0 T( _1 {% ?  o& m$ S9 Z: _- j
( U) `- ?4 k$ Y5 ^
                } catch (Exception e) {
- L& Q+ G6 `* A; r. K/ ]                        e.printStackTrace(System.err);* r) P8 ^. b3 h# Z. Q: I
                        //System.out.println(e);
! Y, L+ E/ c8 a/ @% S0 y; V$ i* Q: I, X                        System.exit(1);
. b4 ?. i: j; l2 `6 S                }
7 W/ ?. r" [+ Q3 q& A, B* X* G* }1 w" {" B8 {$ y% M6 t) o3 M
) G7 h! s$ q( i$ h/ J$ D3 c
        }8 x" X, b" d% B( @5 x8 Y
) o- H: F8 |$ {: ?1 W
        private void swarmSetp() {
6 B* m, \2 j$ s) J2 U- s                list.addLast(new Agent(Id));! {& E% T, N$ B3 K. ]
                Id++;
1 G/ C" x$ C* C" S: J4 W# C: s        }. F7 W4 x, N0 x2 t  F8 l$ L9 j* F! n

' Q. |6 I+ i* b1 _& W        public Activity activateIn(Swarm context) {
6 F1 X9 P# S6 `                super.activateIn(context);
' q: G# A4 M; T                schedule.activateIn(this);+ v9 Z* o: u' |7 U3 o
                return getActivity();5 E* L! {+ B/ T+ J2 t
        }: ~8 V! j. U% n) z3 C% G. X" E

! B; ^* ^, [* I% p8 U        public static void main(String[] args) {
3 T: A2 o7 b( d                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);, [8 f3 f) i, V2 {/ F
                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);
1 k0 {, x3 {0 R  L. n                swarms.buildObjects();
+ W; l% p7 {3 |                swarms.buildActions();8 P' m* ]! l5 s& A6 }
                swarms.activateIn(null).run();5 J6 h$ z$ {+ X4 u9 Y6 Y
        }+ q* z5 W% v  \# ?6 s
" X( R7 l% L8 ^6 L' ]6 O/ v: A8 n
}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-2-25 23:41 , Processed in 0.017727 second(s), 15 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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