设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 8651|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑 * B; J/ c2 m* F4 P4 w5 J7 R, r, p

2 [3 O' @+ j: _. s) S& }; y9 [本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21# [) J3 x- E, B9 m" ^
以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.
1 f% g9 Z* f" R+ i- y$ l2 u& [swarm.SignatureNotFoundException
# K% S9 P% k, K4 c+ w, k, E0 A        at swarm.Selector.<init>(Selector.java:76)
. t; X* U( z1 `. `4 f7 e        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)
8 ]( |5 G( u4 O+ @2 I3 q' i        at ActionGroupDemo.main(ActionGroupDemo.java:67)
' h4 N3 g7 X  y" n% b: a' ~( U7 q* a# x1 P  C

' L* v6 B2 G9 w% J- Kimport swarm.objectbase.SwarmImpl;
' s1 J9 ]8 z- ~0 Bimport swarm.objectbase.Swarm;3 [% K  l+ t5 O* T, C
import swarm.activity.ScheduleImpl;
* e! U0 o4 K( a" b" ^  _5 ?- C: Kimport swarm.activity.Activity;
6 {( {* U( w( w7 }- ]7 ~; t1 `  simport swarm.activity.ActionGroupImpl;
, {' Z$ ~1 ~! W4 `import swarm.collections.ListImpl;
. T. P2 e& ], n8 w8 yimport swarm.defobj.Zone; 9 [+ T) U: ~5 Y' x8 T
import swarm.Globals;: [% I  }# K: a
import swarm.Selector;! w8 m" F9 e7 J. M- l
import swarm.activity.ActionGroup; ; ]: p" N5 u, H' y# d2 F- }
class Agent {# n, Q2 y% _- x( J6 v; `
        char id;
, v3 B; N- s' @5 t) @+ Z* s; A3 o' ?5 q* Y1 J
        Agent(char id) {) t) n# e% q* z' A
                this.id = id;
! |/ Y  r3 s, H$ L7 K        }
7 |- a3 ^* n8 L. V, B6 [2 V& H7 \& O
        public void agentStep() {7 a7 x& I  K! a
                System.out.println(id + ":" + Globals.env.getCurrentTime());  s7 ~2 v2 F: @
        }
/ g7 ?, ?/ b, t4 V}
2 ]8 e7 f: r& V+ H  [+ s  m) v2 t) m# u, \
public class ActionGroupDemo extends SwarmImpl {
9 M' q( N; c3 `+ R! r        ScheduleImpl schedule;# H! u+ `5 w" X4 B% g8 L
        ActionGroupImpl actionGroup;9 A( _5 w" v! d2 ^2 u  j) Y
        ListImpl list;
: o% z8 g0 i2 R# S" W3 b        char Id = 'a';
7 U: Y& x' U1 Z. b; X/ I8 x: r4 |& }& e. f: e( q1 Z! J6 V8 ]
        ActionGroupDemo(Zone aZone) {9 v- q9 O: e4 H1 w  p
                super(aZone);4 ~% [( `4 w# `
                list = new ListImpl(aZone);
7 W; ~$ o+ V* F/ k4 Q4 F3 W. Z                swarmSetp();6 J, I8 H% E/ o: l! T/ O6 U
                actionGroup = new ActionGroupImpl(aZone);( K+ C  C6 n( N/ J
                schedule = new ScheduleImpl(aZone);3 D6 c; A4 G: e$ H: q
                try {
: f/ {; j5 {" n5 m/ P- u* N* @- P                        Selector agentSel = new Selector(Agent.class, "agentStep", false);5 C9 K- Z& H- d) i& T: ]
                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行+ |1 T! _. v( O7 J0 Q* f
                        
! ?# e/ K0 ?$ ^$ `6 r" \                        actionGroup.createActionForEach$message(list, agentSel);
% ?! {. V, }. u. `8 K; E6 j                        actionGroup.createActionTo$message(this, swarmSel);
: l3 z: @: }- d4 h& A: v                        schedule.at$createAction(0, actionGroup);
. y& G8 i" d. ?7 a0 m" p6 e+ h$ r                        schedule.at$createAction(1, actionGroup);
+ n- X+ Y: O9 i" s9 \! @9 w" q                        schedule.at$createAction(2, actionGroup);3 T2 _5 {9 G8 d' Z
& i$ t% R& G, V3 J# w% \
                } catch (Exception e) {
# i/ D: j3 ^0 O9 Z  R                        e.printStackTrace(System.err);
$ v0 o  @+ e# ?6 m, n: W6 _                        //System.out.println(e);
, d) X; ~2 Y$ G4 @: @" Q& f( c3 n                        System.exit(1);
- O( `: x; r! g3 z  F" e                }
  d2 \& i0 B0 t8 R& v; _  v3 `% \7 Y) v  x* R, N  _. s
/ O9 o) E9 k' R# V; N8 b
        }
' u  M* q1 r$ R/ \  p$ q  D; C: H) ?4 J. F4 O
        private void swarmSetp() {
1 h: r5 a6 _  ~                list.addLast(new Agent(Id));
+ ^9 x8 F% x, S0 D. z8 T0 d: L: X                Id++;
* W! @+ C' V8 Z$ p        }% c. i) C# Z6 g- a6 _1 c

1 b* ?, ~$ |% s$ U6 ]: o0 J1 A        public Activity activateIn(Swarm context) {
4 h- M7 [# c' U4 y0 w: J8 q                super.activateIn(context);: [1 s' F8 w0 W5 g
                schedule.activateIn(this);( |6 \& ^' I% k
                return getActivity();' m! R/ W: z* ~3 z& K
        }
$ r( \' d) p' `1 d: _5 E8 ~2 \/ \) m% F3 a3 H
        public static void main(String[] args) {: w* v& K* L+ j* V/ a/ J5 U8 ~
                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);) ^6 t4 m, G1 D$ `
                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);3 o$ H& S2 P( t- K
                swarms.buildObjects();
) }6 ~! M) M( |( \7 i/ Q                swarms.buildActions();( d1 p; m' O5 R$ a
                swarms.activateIn(null).run();
' P/ z+ H! }; ?- N5 H7 c5 V        }  R+ y- O5 y+ D

+ Z3 i4 v6 s: _( z}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-4-18 19:55 , Processed in 0.014608 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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