设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 8638|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑
9 [7 x7 L) _' _* d! L3 M; I# G0 ~% H% C9 R+ y; A
本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21
5 X# B4 C' ~& T+ f6 Q0 G以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.
: G" i" h) h- f, L1 T, r" hswarm.SignatureNotFoundException# W. k) `, {" J& F( c
        at swarm.Selector.<init>(Selector.java:76)
# z: J1 W) C6 J! @) S        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)
$ x2 f0 f& C+ O$ f4 {6 W! |        at ActionGroupDemo.main(ActionGroupDemo.java:67)
' v( T* X+ B8 m0 L
5 ?' G/ S; C, T3 S3 j0 M& v' w8 }) a% A# r
import swarm.objectbase.SwarmImpl;
% o) I% }: z0 |3 Eimport swarm.objectbase.Swarm;
8 c- `1 Z/ T- W9 m. Kimport swarm.activity.ScheduleImpl;
9 g* O8 Z1 P2 P' Oimport swarm.activity.Activity;
! _% E  W. d* C+ J$ M$ f, F7 H- C& dimport swarm.activity.ActionGroupImpl;
. |. v* v  t/ Z' P6 b. Iimport swarm.collections.ListImpl;
0 \7 w6 S" @- U* Q) vimport swarm.defobj.Zone; : N! c( V* K$ j3 K
import swarm.Globals;
5 Q: d' t- z( \, e/ dimport swarm.Selector;
, x. v# H$ t3 h0 E& S. Yimport swarm.activity.ActionGroup;
( b, }4 z5 i, e8 Zclass Agent {7 v" U) {* o( m, A
        char id;
1 R% S' R$ F  }$ _0 p/ k+ x( }. c# z$ q
        Agent(char id) {
0 h$ C% u( W: y2 `4 M                this.id = id;
' E( M. ^. f- g5 Q6 p' ~( j( r        }6 A+ u" z: U& Z+ I. V, l$ B6 `
: U# Z' x3 Y7 ]8 B/ W/ [$ m5 _5 _% x
        public void agentStep() {
4 r( c% F% J" q# S, p6 B2 V3 j                System.out.println(id + ":" + Globals.env.getCurrentTime());
3 h6 }, ^# @9 z$ ~' \" \: N        }/ e6 h5 F( v* h9 v5 |
}
" q; m7 Z( U/ K! }0 ?! R8 C2 H2 n7 Z1 j- y' G" U9 t) Q2 h
public class ActionGroupDemo extends SwarmImpl {7 \$ y9 Z" H9 j4 B. T# p
        ScheduleImpl schedule;
* h- X* b4 M( `& b8 N/ ?        ActionGroupImpl actionGroup;
% \7 h- d9 {" e        ListImpl list;4 U( n' s  E, l0 S+ Z0 l
        char Id = 'a';
  ^, [- ~4 m# @$ i" D# w
' T: @' E! B5 Q6 w/ A3 Y        ActionGroupDemo(Zone aZone) {
$ Y! `; V2 s3 z                super(aZone);1 r2 f0 \. p; f. N7 P
                list = new ListImpl(aZone);
  D$ P5 K, w* q+ K                swarmSetp();
$ n. \6 f1 @7 k1 Z) d. X                actionGroup = new ActionGroupImpl(aZone);3 ~; ~# Y/ `2 F$ d# M; L, R
                schedule = new ScheduleImpl(aZone);" W3 f" @# o' Q5 |( K
                try {
' V9 X6 j3 I' q% y; M                        Selector agentSel = new Selector(Agent.class, "agentStep", false);1 n; \1 X" _6 d
                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行+ O# M% a8 m. c  `5 m; C- {# Y4 }
                        
1 E. P& l/ Z0 @  m: F5 I2 {                        actionGroup.createActionForEach$message(list, agentSel);& F, w& L4 R* W* ^
                        actionGroup.createActionTo$message(this, swarmSel);
( y3 o3 y; X2 t+ R, g                        schedule.at$createAction(0, actionGroup);: T$ V& R! o# _+ b4 f
                        schedule.at$createAction(1, actionGroup);3 x* M8 x4 g9 U$ f, c
                        schedule.at$createAction(2, actionGroup);
# |( q+ u+ o6 f8 t, K4 l8 c8 q, }0 M
                } catch (Exception e) {
, D5 ]' W" ?2 a                        e.printStackTrace(System.err);* J  G* M) J& e& I  ^  j1 k
                        //System.out.println(e);
2 K# B# s( O' K! ^                        System.exit(1);
, w1 W# Z5 [- \0 N# R  ^; p/ [7 \6 {                }" D6 W- d8 ^6 S& R: ]

& N5 D) d" z% b" K6 [" u$ C0 f( g+ p
6 F* p0 X" f& _        }
) k" O+ j+ K5 a) @) a
3 R+ @. o- a" I( b* b        private void swarmSetp() {
5 B8 r9 Q4 Z7 r9 w6 r                list.addLast(new Agent(Id));9 Z' O9 B' k- y2 k# D8 m* b
                Id++;
. j- U9 z! S& C8 a        }
5 v! v5 o+ O$ V) w8 ^% I7 y5 p. _: w- l4 W2 R
        public Activity activateIn(Swarm context) {: M" i5 Q! [) |' s) t. q4 R
                super.activateIn(context);
0 a8 ?& f6 h7 h1 y                schedule.activateIn(this);0 |- t. S- l9 _+ X' X
                return getActivity();3 J! B7 {6 N1 F5 j, Y
        }4 r0 d" s( n" \+ g6 c; {

( i$ I/ _5 Y) W( Y7 y% e0 T+ R        public static void main(String[] args) {# w1 c  e( d' f! Y, x0 Y! k
                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);& j/ c' [2 c0 ~4 _4 t3 |* U
                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);2 e7 d" W* ~) n& q5 V7 O' }
                swarms.buildObjects();( u# U. I1 X7 i  i, }4 A5 f/ M
                swarms.buildActions();( z% K& |. i! ]& q) |0 O% @  [
                swarms.activateIn(null).run();
8 |7 ?; `( @: v. A% P- e        }
  o6 V: s* E: j+ v5 C
: u& ~, d' F! h2 d7 S$ M}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-4-18 12:25 , Processed in 0.015919 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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