设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 12582|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑 9 r" {7 a; T3 ]

3 J; B9 Y4 {7 Q/ R本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21
: L/ q$ o3 R: J以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.9 w# g+ @+ c5 G  p/ `6 s5 p' ^
swarm.SignatureNotFoundException
6 @! d0 X2 ?8 G! _2 W        at swarm.Selector.<init>(Selector.java:76)
' d& L4 Z" @0 d* V% O* i3 J  G4 k        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)
5 \/ `9 A# z5 w( f" t; L' u        at ActionGroupDemo.main(ActionGroupDemo.java:67)6 m( A0 W! y7 j! ^8 J7 b
" L$ {! _% q# {! K( n. f) k
7 J0 l; Q3 q8 [
import swarm.objectbase.SwarmImpl;, M# M9 c# a3 [) r0 s
import swarm.objectbase.Swarm;
( A# n8 s) Y& I9 ?import swarm.activity.ScheduleImpl;
8 E! N8 W, v2 a1 \, w, F9 B  fimport swarm.activity.Activity;1 F9 [- {! G8 l* C0 e, ]6 y
import swarm.activity.ActionGroupImpl;8 A; g2 [7 e! G: _! ^
import swarm.collections.ListImpl;
. Y: ^: O4 z# `& c0 v# q+ Himport swarm.defobj.Zone; 2 e% u8 w6 f! h# S4 V
import swarm.Globals;
* S1 W4 ?2 D1 y3 Cimport swarm.Selector;" B0 _1 a1 _) i4 ^
import swarm.activity.ActionGroup; # A# R' N, @; N; p. t' h: `. i( w
class Agent {
) ?' z# a) b( E2 Z        char id;3 b) Z7 X/ w1 ^# e

% F0 x5 i# b. O+ ]" o: L        Agent(char id) {( W4 k9 G( N- Q2 P
                this.id = id;
- w7 r7 K0 }4 O+ M) w- ^        }7 {3 g% e7 E9 F2 V5 E
' I, \8 E2 H7 `) S# u# v( }  F
        public void agentStep() {1 q9 d) A  O. c% M; s0 [) a3 ^2 _
                System.out.println(id + ":" + Globals.env.getCurrentTime());2 d/ S4 J5 J* F( G& A9 k/ g
        }
# @/ `  q2 d$ C! Y/ I& O5 F}
9 A' a! @+ D! r9 B( G: ^% @
4 v, S2 {5 [5 E% O$ dpublic class ActionGroupDemo extends SwarmImpl {
6 C1 V; E1 N* |! V% U        ScheduleImpl schedule;
, f. c  Q7 A7 E4 g# w- B        ActionGroupImpl actionGroup;# J' k1 L1 |6 R: e
        ListImpl list;
. z3 O; ~; c" g$ u& H& G+ U& n        char Id = 'a';* i% x. U* e1 Y5 B# f5 {
0 @5 H# v+ x" B5 b3 w" x2 u
        ActionGroupDemo(Zone aZone) {
4 c) u( A$ p- t" s7 t; N; c                super(aZone);/ R# k0 D5 T6 W6 |: c
                list = new ListImpl(aZone);- [+ l  O: x/ r3 f
                swarmSetp();
0 j2 w, {' }# Y+ W6 x' G) I# I) `; V: c                actionGroup = new ActionGroupImpl(aZone);
" E& o9 Y& w3 l5 U) s* j                schedule = new ScheduleImpl(aZone);% m; @$ Q, q$ j
                try {
1 a2 W! F4 S6 Z3 ~  {4 U                        Selector agentSel = new Selector(Agent.class, "agentStep", false);8 M* s9 I9 ]) @% N
                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行5 \2 U4 f8 M# ]: T7 N) G
                        
: o: g- @: K* r+ Q$ T                        actionGroup.createActionForEach$message(list, agentSel);
# x3 E' A/ h- W" Z' S5 M3 \                        actionGroup.createActionTo$message(this, swarmSel);( D$ i2 b( U. h* ^2 ?
                        schedule.at$createAction(0, actionGroup);, B" Q$ `1 V. s* h2 X0 m
                        schedule.at$createAction(1, actionGroup);$ M: S$ r# h, Z# B$ r* M: t
                        schedule.at$createAction(2, actionGroup);1 U0 Z& c" a+ @9 n  q: i" w8 G

. t$ ?6 ]2 p: V, y                } catch (Exception e) {
4 Z7 F. _, Q+ X                        e.printStackTrace(System.err);0 V' `3 a) P& V" T
                        //System.out.println(e);0 @$ A- n; j( @. A1 {& L
                        System.exit(1);, D0 f9 F+ R8 t5 I& m! l* `8 g4 @
                }! I1 x! y% _1 b/ K( R
6 O- ]. D8 u0 B! |5 w
3 m0 K6 _. t7 {4 [7 W/ v
        }+ M+ h2 x# A. Q( @& t0 e. _" F
; W% _# s* y: }
        private void swarmSetp() {& c( s; B; j2 O* D5 j7 w
                list.addLast(new Agent(Id));
2 b2 s0 t' z8 G- y% L                Id++;" j4 ]5 b0 g3 F6 }& _/ L+ h
        }/ I- f/ y" O! y. \$ i# K
5 y0 h+ x7 ]1 Z) X3 r
        public Activity activateIn(Swarm context) {
/ y$ @6 F- P# y9 T! x0 I6 e                super.activateIn(context);6 `# q/ Q# R* J/ l8 d
                schedule.activateIn(this);
$ |, B& z6 X8 v2 G+ n& ^1 B                return getActivity();
, h6 S6 _9 I- ^        }
. a. h( k5 I6 S+ T
4 i2 @# D5 j9 r+ o1 I! t        public static void main(String[] args) {
; c7 l- L% e7 s8 y! Z" d* D5 u1 X                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);
# z. h  N# g- S9 [- s                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);
8 h0 A; J. c1 s  e6 z8 ~                swarms.buildObjects();
; \+ K8 }* ?2 x1 }' a; N$ J                swarms.buildActions();8 H0 C7 y% x3 y
                swarms.activateIn(null).run();
8 z! h0 Q' K% z' ]        }  a$ y: U& Q9 t# R1 {

8 X, L, x2 y" f" c9 \}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-8-12 23:15 , Processed in 0.015239 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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