设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 13695|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑 / t& {* S  @0 k% Y3 H2 I$ `

; l" w" k: `- f/ N( h本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21: L7 M' j- l  G: ]' o* r
以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.
) Y  L/ l, g  A/ j2 ?' eswarm.SignatureNotFoundException
' I: v- \' w, @) s- P; a: @        at swarm.Selector.<init>(Selector.java:76)) ?( [/ ]# d" O  w0 y+ {
        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)
6 ^) U! L( I( ~        at ActionGroupDemo.main(ActionGroupDemo.java:67)! P" y+ ]) f' j5 F# c

5 `+ r, r5 M0 T* G! y  L% b
- h* l4 ]% l" D, y7 B+ ]; x6 vimport swarm.objectbase.SwarmImpl;: u* V' r' p# M& z8 E, }* v9 A
import swarm.objectbase.Swarm;, u4 _, o8 {- c1 W
import swarm.activity.ScheduleImpl;
+ E- g& l& l/ ^7 I* H  j- |import swarm.activity.Activity;% e& Q: [1 m7 K  b, e0 h
import swarm.activity.ActionGroupImpl;
) O+ n9 B0 K0 aimport swarm.collections.ListImpl;
# Z) s. q/ R4 Jimport swarm.defobj.Zone; ' q. V' }7 u( s) B
import swarm.Globals;% o6 F& L# T9 w: G2 K
import swarm.Selector;
0 E- L. _. E/ Gimport swarm.activity.ActionGroup;
  t2 w1 [: o+ x1 [class Agent {
0 @( i) x$ m# v: d# l  d6 k        char id;* I. e* ?( Z% O3 U" e$ I  l
. |! b# K/ J/ p, q) s8 e; o
        Agent(char id) {
9 p+ _& ?( o" i1 D% A                this.id = id;4 C3 M* v9 y' f1 I9 e
        }
6 W% o+ J, p: K" ?
! E; n) g) O0 |        public void agentStep() {% s, N8 N) a! L9 Y/ X& t/ z0 X7 k' n# }
                System.out.println(id + ":" + Globals.env.getCurrentTime());
# ?' w3 _, K% q* y/ s- L, m* x        }* O! W- x. r$ c* C" I( J2 G4 Z+ _
}* C3 {" `+ c) d9 x8 T3 V5 u
1 k6 o$ e* ^: X; C7 B$ @# t
public class ActionGroupDemo extends SwarmImpl {  R+ d* k  e  ]9 `
        ScheduleImpl schedule;" Q7 m4 A& v0 i( S0 e# t1 u
        ActionGroupImpl actionGroup;
% w8 K+ G" K. S; g. U        ListImpl list;
7 T: M7 x0 |' u0 w" a: P, _        char Id = 'a';( M2 ?9 q" V' ~$ g! A; R

4 `3 l- R4 G$ }( A; ~1 q8 T/ v; o        ActionGroupDemo(Zone aZone) {
5 D8 n9 B% F) ~. }  L1 |  y                super(aZone);& C! o9 E" e  t0 Z: Y: i0 }2 ?
                list = new ListImpl(aZone);# P- U# `9 a; K
                swarmSetp();; h; M8 D2 x7 V5 G: b2 g- E+ D
                actionGroup = new ActionGroupImpl(aZone);' ?% H, j8 T5 o; _/ z  }
                schedule = new ScheduleImpl(aZone);
& c% s: f6 r, X/ {                try {1 J4 u' m: c( z3 B
                        Selector agentSel = new Selector(Agent.class, "agentStep", false);) R8 w( V, K0 B: m
                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行( H$ I6 ]! E2 P- H. q6 o
                        
; z- o' m, V, Y6 t                        actionGroup.createActionForEach$message(list, agentSel);/ V& h. B% ]; Z" {( S3 K5 _
                        actionGroup.createActionTo$message(this, swarmSel);# j& O5 k3 s1 A) q# |9 _4 B% L
                        schedule.at$createAction(0, actionGroup);" N4 B' |" `$ j" s1 S) R" E: `, Y  y
                        schedule.at$createAction(1, actionGroup);0 G1 J+ S9 h6 p3 i" N
                        schedule.at$createAction(2, actionGroup);" n* {/ Y3 P! ?
: ~1 Z' e& P. [& K3 V: Q/ b# \
                } catch (Exception e) {
- z) k; l' w& Q0 s" Q2 Z                        e.printStackTrace(System.err);
( \* k0 X5 f) g8 L                        //System.out.println(e);9 [! Q0 s' Q* R% W5 Y/ X
                        System.exit(1);
: _/ e$ j+ J4 W$ a' J) K2 V  V                }
; f( K5 r) H0 }3 o5 l+ x8 Y! |1 \0 x! `( Y( r
8 C' V* O/ R/ P, K% I0 O0 K
        }4 m  R( k- M/ R

" X/ ^: R& }, \% y        private void swarmSetp() {
8 \( T4 t, o/ }5 ]9 ^+ a' ^                list.addLast(new Agent(Id));. D  }. l3 @1 Q% ~% f, O3 b
                Id++;6 \$ i$ C0 J/ a
        }
3 x8 P' F' H) w4 o+ g# Q# X
6 d8 c9 b% b2 ]* q7 c$ g        public Activity activateIn(Swarm context) {
' h) C$ Y1 v2 p2 G0 D                super.activateIn(context);
4 C( J: V8 A% r- b5 p) Y" `+ _                schedule.activateIn(this);
  u; x% g: E% U                return getActivity();
% h) Y9 P" B% S0 u        }) {* _' L3 z/ K9 G' Z6 R" Y' U0 u

% @' I! O. G9 Z* K0 D1 X& |- v/ C        public static void main(String[] args) {0 ?) c+ _+ t7 p, N8 J7 H) C) n( l9 Y
                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);
- R3 g, l5 ]% G2 }                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);  T& W3 F* [/ K) B4 ]4 P$ m( R
                swarms.buildObjects();
) I0 @/ M5 H  h6 J. G  }                swarms.buildActions();
* @, b. `) z' Q+ f$ k0 |                swarms.activateIn(null).run();& P0 E7 Y& @) a# l/ @$ u# @
        }
2 O; Z6 Q! i6 P. z7 \( V
/ s  H4 [: Y7 U5 R}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-9-14 17:24 , Processed in 0.017192 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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