设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 5604|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑
0 ?) R2 l8 q4 ^( C
- U% l8 ^+ R2 T' O1 R本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21$ [6 R( X$ ^- ~# G+ A3 X) ]" ^
以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.# c% D6 J# t( Q
swarm.SignatureNotFoundException
4 Z( C0 g! X; G' S: `- }2 i        at swarm.Selector.<init>(Selector.java:76)% A' ], g; O% ^# n5 ]' w6 z
        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)
& Z2 L, S, _2 y1 d        at ActionGroupDemo.main(ActionGroupDemo.java:67)
+ l) ~# T1 N9 x6 I& l; g4 S! y, X6 \6 c; F* ~

6 E5 q" j& b, i2 x8 q* g6 fimport swarm.objectbase.SwarmImpl;
9 |4 Y( h% k2 ]) W" Wimport swarm.objectbase.Swarm;# v5 l; o* L: O5 f  q! ]* h
import swarm.activity.ScheduleImpl;5 i# C: G9 J* P) i% o2 ?
import swarm.activity.Activity;: `& r+ [* Q: d- y# S
import swarm.activity.ActionGroupImpl;/ E/ q8 _# y2 v1 [4 y
import swarm.collections.ListImpl;5 j7 r/ _5 i2 X- ]9 s# ]2 ?- q
import swarm.defobj.Zone;
# [4 Q3 H$ a$ t* f5 n7 Wimport swarm.Globals;( f; w( @7 h: M
import swarm.Selector;
  c9 U; E% I% a, [import swarm.activity.ActionGroup; ; b+ W8 ^3 r" ~( b8 `& I, k: b) A3 f
class Agent {
# c1 w) J% S8 p' H" C; D        char id;+ T' t9 o+ N$ v& Q3 E8 T

, m' g3 ^( ]- ~3 c        Agent(char id) {
, r, B4 O" U- ]+ i' p- `                this.id = id;
* {& D: k+ b, H5 l: \+ T' f9 l+ _+ x        }
* y& F* S% B* i2 z+ H% o; q5 r6 `, S( U. y6 ~( u
        public void agentStep() {2 n4 t" H  e& J" C. ~  g
                System.out.println(id + ":" + Globals.env.getCurrentTime());+ g* K' p$ b0 K+ D- |) ?2 e3 K
        }
& A# y4 M2 }+ g. x5 P; c' e}# t  Y7 `& x' Q9 i) M4 U1 Q
) A/ |3 e) S# Z% k
public class ActionGroupDemo extends SwarmImpl {& J7 N' L* j7 _" a. D# @
        ScheduleImpl schedule;2 ?" V$ I; S: k8 j' G7 s
        ActionGroupImpl actionGroup;7 {. \! _( V3 V
        ListImpl list;; y: c4 O, B+ p: }$ a
        char Id = 'a';
7 S) n" l/ Z6 x" U% ]- m2 x5 h' o9 Z% r* z1 o
        ActionGroupDemo(Zone aZone) {. h& N) ]0 ~% g- ~
                super(aZone);
1 u$ `) M7 ?; ?0 B  W9 {  k                list = new ListImpl(aZone);
0 ^9 A2 V9 q. L+ R) Y0 h0 I, f                swarmSetp();
( m- i3 |' o1 p, ~/ n) S3 w" D                actionGroup = new ActionGroupImpl(aZone);
/ F& w2 Q/ [" d& g                schedule = new ScheduleImpl(aZone);
) B' L" |! v6 y& ^0 \6 u+ U                try {
% ~5 c* s; `# Z6 J4 X                        Selector agentSel = new Selector(Agent.class, "agentStep", false);
' a, V* _/ Z7 |! u4 ~                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行
. K7 w1 }, Z7 _4 f( @8 I8 X. C; y                        ; n' |1 J% s) {! D
                        actionGroup.createActionForEach$message(list, agentSel);
9 G; p3 e1 Z. h% I0 B9 K                        actionGroup.createActionTo$message(this, swarmSel);
. Y9 U; m* d. S- H                        schedule.at$createAction(0, actionGroup);, j% U& j2 v' s! n) h9 ~( h
                        schedule.at$createAction(1, actionGroup);; }1 G8 I2 U4 L; S0 m' _
                        schedule.at$createAction(2, actionGroup);
5 K' _' o; d6 H; R+ S! C8 D
( @1 B7 ?% j3 F) J                } catch (Exception e) {
/ |3 y5 Y' p& X0 {                        e.printStackTrace(System.err);2 x: W0 _  z" S1 @
                        //System.out.println(e);
% b/ N3 k; _0 M8 s8 [) E                        System.exit(1);1 f, ~4 D0 f. q
                }
1 X& m' a2 T: o1 s# W& o8 E
3 I' @/ G2 Y; T5 ?1 H6 \
) j" v% _/ x8 ?! Y3 B6 d  |7 M2 ?: g        }
9 n! ?: Y& |. h/ F. o
0 `5 f' ^2 x; q2 @        private void swarmSetp() {
/ r5 }- [* q; @3 O  l4 e                list.addLast(new Agent(Id));' L2 W- I2 Q0 ]$ d0 e! y' l
                Id++;
' V, U% K9 n4 |* t. ?( ]        }9 s, R. H& D0 w' _9 [

. |! W& C) ~! F! z) Y) X  A        public Activity activateIn(Swarm context) {9 x/ c( p. y' y" A5 a% ^+ t
                super.activateIn(context);
3 y6 L1 S2 x0 L1 V+ |; r                schedule.activateIn(this);4 S2 g$ i: p/ e$ T
                return getActivity();1 P. Z- M# N) }1 o
        }8 P3 _& Z5 I1 Y. b5 j$ U4 V5 U

: m4 H! c: y2 S7 f1 L$ ~- w# |9 L        public static void main(String[] args) {
% m* A) [& Y1 o, i                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);- u# l3 l' h  h% d% D! _$ R9 W) b
                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);. F* V  D' K  h5 H: ?2 n8 x
                swarms.buildObjects();
: a  [; t5 _; D                swarms.buildActions();# I" [! b/ }5 G) X8 q
                swarms.activateIn(null).run();
* u' [% _2 a! ]8 V) {  U; n9 b, a; c        }
# `- h2 o" L& G2 g) P# L
  Y: r* o& ]  M* C7 B7 B}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-12-15 04:01 , Processed in 0.028483 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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