设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 9030|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑
' ]9 ^# S1 N8 d) L
+ O6 o4 A: n, f, J本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21& S8 J& X/ C- ~
以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.9 ?- s. w' p9 |, t% y
swarm.SignatureNotFoundException
6 M, f( N6 n  y) }3 H        at swarm.Selector.<init>(Selector.java:76)' ~9 n' H; k9 ~; I, V; d
        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)& ^% ?0 x/ @  f; d* J  g: h
        at ActionGroupDemo.main(ActionGroupDemo.java:67): A, Z! Q* O0 N+ W3 K
5 R1 m- k0 `' T* k

6 s8 t( V6 t  X, m* X9 ]( uimport swarm.objectbase.SwarmImpl;
9 G$ g# f' n9 G. Y' Gimport swarm.objectbase.Swarm;
/ {0 ]5 ]( T9 l& x( H; x( d! Rimport swarm.activity.ScheduleImpl;
8 Y" \9 J- @, t& t3 [import swarm.activity.Activity;
" h' @% {5 W9 M9 E, O9 ]2 b, Aimport swarm.activity.ActionGroupImpl;
6 C0 e% F0 ~/ Kimport swarm.collections.ListImpl;
8 C1 S  u3 g$ x' w8 k) Kimport swarm.defobj.Zone;
* s; H' b0 H7 X8 f$ U7 x5 himport swarm.Globals;
) [2 o0 l2 U7 Vimport swarm.Selector;
: @# B* `6 F4 ~7 z2 Yimport swarm.activity.ActionGroup;
- n5 D/ y# ]/ g( }$ U+ Sclass Agent {
" `& w: @; `7 j) H        char id;( U: Z- m! J/ H2 }$ I
! U3 B  o1 M* E) k0 M
        Agent(char id) {
2 Y# U' H9 w3 X                this.id = id;
# X, R! J$ O  F4 D. e        }$ [5 N( D" F8 x
8 I: z; Y. v. g+ h9 E5 K
        public void agentStep() {
! ^8 r% ^: Z7 _: y2 w- X                System.out.println(id + ":" + Globals.env.getCurrentTime());
2 M2 p" S$ I6 c        }
' d5 w( o5 Z3 A}
* M$ n2 V& q( J6 J  K; w" g
8 W! [. \  t! x  y2 `3 f# hpublic class ActionGroupDemo extends SwarmImpl {2 l" S9 @0 ]9 q1 N/ w" R! _' h* B/ b
        ScheduleImpl schedule;3 X# f2 `' M; ]2 b3 N" |, X
        ActionGroupImpl actionGroup;
7 V" j4 \2 Z7 [& I: R9 c5 ]        ListImpl list;/ E( |+ F) A9 B; z  Z5 f
        char Id = 'a';: ^& `% v& R3 j" g

  }9 S& k, J2 b% d; D        ActionGroupDemo(Zone aZone) {
; i$ l' @: C3 e5 Y+ {2 @; j                super(aZone);; S6 a$ E& c4 F. z& f' @1 u
                list = new ListImpl(aZone);" Y. L) x  h0 N: Q- V" |
                swarmSetp();
4 @* w9 @; w/ ?% |8 ^  d/ o                actionGroup = new ActionGroupImpl(aZone);
! y6 a( c9 H% a3 k7 y  p$ w' a' k                schedule = new ScheduleImpl(aZone);. J! q! ^% G5 v) x$ f. r
                try {
- R, \; \$ Z: B; I                        Selector agentSel = new Selector(Agent.class, "agentStep", false);! h( O) H+ B3 U. A
                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行" c7 P( j) U4 q  u. V2 _7 U% y5 R
                        
5 R$ r" U3 ?3 C7 L/ ~                        actionGroup.createActionForEach$message(list, agentSel);
  G9 E2 B: W) c/ u8 u                        actionGroup.createActionTo$message(this, swarmSel);
6 j1 ]( B1 J9 y$ }                        schedule.at$createAction(0, actionGroup);
# A5 P6 B5 O( Y4 V" T* |* _                        schedule.at$createAction(1, actionGroup);9 M9 u* Y0 q+ Q0 `
                        schedule.at$createAction(2, actionGroup);
( ]! m+ g2 J2 j5 c5 ^2 ?& I  i" I7 \! S
                } catch (Exception e) {
+ s1 ~4 ]& z) y# N" w& x* N+ D                        e.printStackTrace(System.err);
/ J$ [" E% A* f$ r                        //System.out.println(e);$ t0 ]9 l' v3 d0 y. d1 M6 [& W+ f
                        System.exit(1);
1 f: O3 N! y6 e% h9 G                }" f/ n+ Q8 _2 g$ F2 J

. y5 F  k4 M' A. J
8 b8 i6 ^* V  J        }
7 V! v* I7 u  f0 P5 [
# I3 T! G- R3 O: [, }) f        private void swarmSetp() {
" l. C' {! u5 o; y9 ^& ~# f# Y                list.addLast(new Agent(Id));
4 a$ O" T4 m& V2 b/ C                Id++;
" X- f5 N# |! U# b4 ], Z        }
1 V/ Y8 Q4 k1 p7 `8 p
$ [0 [+ u% d. Y5 O$ h        public Activity activateIn(Swarm context) {# p( U9 Q1 G9 y+ d
                super.activateIn(context);0 y, N3 Q: C  f$ C
                schedule.activateIn(this);3 n- g4 S; U* T4 Y' c
                return getActivity();) m) D2 m( q$ y+ N1 n4 P
        }
- [) B8 v! x% }0 V0 \2 `/ V' |0 y. s2 ^. y; ]
        public static void main(String[] args) {2 Z) c( D* A( E
                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);2 R/ J% T5 R9 z% K  D
                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);( ?# [& Z) e, x; P* V% i$ A7 I
                swarms.buildObjects();0 V! ]# f/ j% w7 i: @$ U7 O, {0 y
                swarms.buildActions();$ h  i8 O' P! q, s
                swarms.activateIn(null).run();: U9 b  l9 v/ f, ^7 l) X
        }( T+ G  O( o+ R! Y

( |' \8 F( |5 Y5 s; F}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-4-29 15:24 , Processed in 0.014595 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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