设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 7727|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑 6 r6 f& B- q1 A+ f0 o: Y
1 k/ R4 d) P5 V  `' t# h
本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21! x- G2 B# a  J7 d/ k" m+ M! d
以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.
" H. y# T1 @5 V5 |6 mswarm.SignatureNotFoundException" w2 o% u5 \' T1 R3 P) v) X
        at swarm.Selector.<init>(Selector.java:76)" a  ~6 p) r& L8 U) W4 U0 p' S
        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)
& ?( m8 J: X8 y4 f        at ActionGroupDemo.main(ActionGroupDemo.java:67)! \& \9 _# k5 {; n& n6 y

) x3 A& b5 ]! v) W1 R" U( u+ r' P1 y$ V  \" {2 Y& l7 p
import swarm.objectbase.SwarmImpl;9 F3 ~- ^' V# i3 C
import swarm.objectbase.Swarm;1 b5 O5 [! G! {! U
import swarm.activity.ScheduleImpl;' P# M& e: K  N8 F
import swarm.activity.Activity;3 v) g/ p$ l" W9 V
import swarm.activity.ActionGroupImpl;
" c- a4 X: h7 [4 r6 n6 W- e# S  Dimport swarm.collections.ListImpl;
1 ?+ Q; [% i: [- ^/ R$ E1 B* v- Zimport swarm.defobj.Zone; 3 ~7 r8 k: d/ J
import swarm.Globals;. t$ b  Y) U. Z! Z+ f
import swarm.Selector;. c. P9 O) }, g# V* h
import swarm.activity.ActionGroup; ' c4 n$ k. l" M* J4 m' A# o/ X! J
class Agent {
" d# G! g% ?& X" a3 M7 Q# ~        char id;$ N; Q) X" b8 }- k, v! Z% Q4 [

5 ]5 }8 j2 t1 l% |! R* T5 S        Agent(char id) {! _8 o/ F( }8 r6 P
                this.id = id;! u0 p$ ^. Q& S: Z3 @* R: U% z
        }; p" G6 W% l" l* e' ~$ l2 G

6 I! `" _4 m' y! u) q        public void agentStep() {' {( F0 W$ }+ d  T7 f
                System.out.println(id + ":" + Globals.env.getCurrentTime());$ _, I1 h- ^7 n# I
        }, l$ v9 W3 d7 r; l! }9 l' I: j
}
. w, ~' i4 I# p. d; M1 b9 A7 Y, U, A$ X6 S, L
public class ActionGroupDemo extends SwarmImpl {0 i2 d1 U( `) G
        ScheduleImpl schedule;
/ f1 o0 m) C% o0 q/ k) c. {5 s        ActionGroupImpl actionGroup;
' g; [8 U' E) g# t7 }        ListImpl list;- r% C3 e7 P: R. L& x% q8 Q: Y6 u; P
        char Id = 'a';
- H( b: n! l* E: X& k- O& O: V4 i" F  n6 E8 c4 X
        ActionGroupDemo(Zone aZone) {9 p) L. f! _5 {7 F0 X- M+ C
                super(aZone);  f) ~0 E1 g" L# j# N% \
                list = new ListImpl(aZone);
" B  m3 c: p: G+ e# c6 x+ ?* F                swarmSetp();) ]# T8 M5 g% M! c3 r! R* d, h
                actionGroup = new ActionGroupImpl(aZone);
$ s9 f& j/ }! A                schedule = new ScheduleImpl(aZone);
  H" m( X- P6 q& ]  c4 ?                try {
# L; d4 R# i9 L* w                        Selector agentSel = new Selector(Agent.class, "agentStep", false);4 {! M! t7 H* X6 R
                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行
' y0 i" v4 n; |7 X$ z: y9 n% B- i3 _                        
5 k" R8 O3 \) H. W4 U3 n9 [2 |                        actionGroup.createActionForEach$message(list, agentSel);* t( m" `6 T$ {2 b% G1 g
                        actionGroup.createActionTo$message(this, swarmSel);8 O; t9 L# w, \9 j0 h2 F' C5 S+ r
                        schedule.at$createAction(0, actionGroup);
4 B2 N& K  O5 F" E. ]0 x$ L- t                        schedule.at$createAction(1, actionGroup);8 H5 a% d9 E  k7 W$ `) g8 F
                        schedule.at$createAction(2, actionGroup);1 _. Z2 @8 c5 @% w  {
! U3 u9 v/ w' t  K  E1 Z3 Y  V
                } catch (Exception e) {
! D6 i* W9 O9 K& B4 q                        e.printStackTrace(System.err);+ @$ T% J3 J  I
                        //System.out.println(e);, k3 H- W# [7 t( P
                        System.exit(1);
  u/ E3 d. }+ l# e7 |$ \8 S                }8 w$ j9 G. W. `4 P9 J0 y

. s7 _, y4 X& U6 ^& g; L
0 d# ?/ u+ X7 E; H; X( _4 X        }
+ L6 L$ Q$ ?/ ~. @. N& M( ]2 F
% z$ {/ m  K: x" {; g/ z$ k6 l" X        private void swarmSetp() {
4 q3 l# j4 [3 J7 D. O5 _( R( u                list.addLast(new Agent(Id));
9 O4 F6 X2 E* K6 @; t                Id++;
* g2 _9 [) w' `3 e( q# F* G        }* U  W9 W  F+ |* G% f9 i

. }" l5 X3 y7 E/ v  r6 x: g        public Activity activateIn(Swarm context) {
6 @, r+ Z+ ]- X- @5 l# g                super.activateIn(context);0 B/ b3 r# ~- x  S7 Y# g& h
                schedule.activateIn(this);, O3 x# C0 P8 `
                return getActivity();
6 d5 A6 n, h* c* G2 V! |' n7 d        }/ l5 K+ x1 d+ a3 f- W7 D

& {- c3 `5 M$ P        public static void main(String[] args) {% j2 w+ E8 r9 v8 n9 D1 f4 P9 E
                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);
; s) x+ l0 R8 C! a) Z, _: D- q$ ?- j                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);, r! f- Q( q. x( T
                swarms.buildObjects();& `' @1 ^* \4 j0 g) Q7 ]/ L
                swarms.buildActions();/ ]  E& I7 B3 M0 \' \$ \# Q
                swarms.activateIn(null).run();
7 G9 I: T4 l3 w        }- W  N! [( c* U3 u
7 B+ a5 d  |  K2 q1 H# R
}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-3-12 21:27 , Processed in 0.021408 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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