设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 9918|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑
5 Q, c- c' Q  c3 r
% d1 I# @$ P' ^: u( A$ H1 N0 r- j本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21
" o+ ~: n4 l7 L: c/ R, V8 g: n; Z以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.
# p& v  G% ~0 g1 h) wswarm.SignatureNotFoundException
& o4 _8 d! C" R; ?0 i9 b+ `        at swarm.Selector.<init>(Selector.java:76)6 X0 h6 n% {) z! n9 E" L8 W8 j
        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)/ [5 _0 u0 {4 H/ b4 c, Y8 T$ T/ a" a
        at ActionGroupDemo.main(ActionGroupDemo.java:67)
+ x1 B# I2 r6 C
7 O, D9 E4 S6 E. e6 K8 ~, \% ~
/ S. P. N) Q6 x) c, _2 P) Zimport swarm.objectbase.SwarmImpl;+ S( a9 \" f8 g, ]9 m7 t
import swarm.objectbase.Swarm;
' K# m1 M! f. S# Aimport swarm.activity.ScheduleImpl;% F; G5 }6 ?9 A9 x
import swarm.activity.Activity;6 j5 v3 E7 c3 i6 p/ T
import swarm.activity.ActionGroupImpl;
  u8 _& s# h. P' Gimport swarm.collections.ListImpl;4 {( ?; G) `7 m
import swarm.defobj.Zone; 2 ~+ e8 Z' P& W) b8 B0 D
import swarm.Globals;5 R  a4 s3 W: `; a1 F- E+ k
import swarm.Selector;
  ?5 j2 m  [, eimport swarm.activity.ActionGroup; + {5 u: \' C: k' p  n' z
class Agent {
9 y! k" ~) q1 M# ?$ O        char id;9 @# F2 ^) B$ L4 @8 r3 [+ m

- r; ^% A, a1 n  o        Agent(char id) {
, V, U8 Q, a% z! X8 r                this.id = id;3 @& K& b$ L: Q9 T0 ]  M
        }, H) X) j! Q) a5 P0 H$ O
& `, h4 x2 C: j+ X3 q3 Z2 o
        public void agentStep() {$ u5 U( P$ {$ z* L3 w. s' ~, ~; W
                System.out.println(id + ":" + Globals.env.getCurrentTime());
' d9 ?4 E9 t" q" |* d        }
' F2 O" \$ ]' S# |7 P3 N3 x' i}
, \  C* E3 k) L. z7 t# V% }2 m& H3 P
6 t8 h) U0 L2 f/ @8 |( F+ kpublic class ActionGroupDemo extends SwarmImpl {
4 j2 C4 B- g! }8 a        ScheduleImpl schedule;% x6 ?1 x# b3 y. R5 J5 v
        ActionGroupImpl actionGroup;2 Z, E! s% i6 F4 v3 e
        ListImpl list;
: |( B0 h* L0 O" }. z* [        char Id = 'a';
' A) v6 q- y2 v; G* S- k
0 N5 M# Q, Y+ r2 w, j        ActionGroupDemo(Zone aZone) {# F. K) A2 u" w7 Y' k; U# M! ~
                super(aZone);# ~5 J  @9 [( ?9 A2 f. Y" }
                list = new ListImpl(aZone);
; v, R" t+ @1 K' e. z2 R  `                swarmSetp();5 r3 Z" g: J8 m9 E8 |
                actionGroup = new ActionGroupImpl(aZone);
+ m! y" ]( U5 s8 Y! c( i                schedule = new ScheduleImpl(aZone);
5 @5 R- }! \  K! E                try {, N- F. E* o; Q6 [& ^, I* |
                        Selector agentSel = new Selector(Agent.class, "agentStep", false);
) @7 C- ^; S* f9 d                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行. x: {4 J0 T: i# j1 I8 b0 B
                        : Z5 K- S$ x0 _& ?) x3 `
                        actionGroup.createActionForEach$message(list, agentSel);
3 V- d* X" M5 k6 x' D4 c  Z                        actionGroup.createActionTo$message(this, swarmSel);
( w! {/ r$ Q, X+ v* y  s                        schedule.at$createAction(0, actionGroup);
, `) s: }5 O# A7 d                        schedule.at$createAction(1, actionGroup);
, R6 ]& k  b% A4 ?                        schedule.at$createAction(2, actionGroup);4 N. l% {3 D, \3 G# y* R
/ g( z% H# Z6 m2 K; E! a+ X
                } catch (Exception e) {  R8 ^8 u# w7 n$ V( P; M. B
                        e.printStackTrace(System.err);
) R  o9 |: J& |7 {                        //System.out.println(e);7 j% K* S  r2 i& [; `: f9 O  j
                        System.exit(1);* f( S/ A5 k: |2 _, y( P
                }- T# J" {8 X: s7 s) e+ \

$ f5 D% G% b6 N* s. N1 F6 k* O
( R$ b8 R% p. f# `: I1 `- n4 Q        }# N( B& Z2 Y1 K2 c1 p. f, @
( ?3 c! g( m3 {: C3 }. G; a3 c
        private void swarmSetp() {
3 Q5 _1 ~( `. _; X( A1 a1 K+ j4 R                list.addLast(new Agent(Id));* L5 t# @8 T" i' l" a" i
                Id++;
! }3 E& J7 u% K7 l# }% g        }
, y5 `& }: m' E! _) y) u  X8 |5 I' u/ r& Q! s0 V/ V7 U+ ^
        public Activity activateIn(Swarm context) {
1 K# w! Y7 S6 d$ E                super.activateIn(context);# W  }( |& W1 _, l3 E) P% Q0 z- _, [
                schedule.activateIn(this);0 x$ p2 I  n  G* H, Z. I
                return getActivity();% [- E+ o" J* ?
        }
8 K  @- s" L. F+ g9 ?# r+ r/ ]+ I/ f% t" J# `0 c
        public static void main(String[] args) {
7 V+ U& I% c0 }6 r                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);
! d" J/ p. ]: j. g                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);
- m) ?& e: l* m! ~5 w                swarms.buildObjects();1 {1 w/ X% v! {: R! l! B
                swarms.buildActions();
  u* g. h4 q6 R+ ^& c                swarms.activateIn(null).run();& H5 F2 G! t0 O9 Z- n0 j2 E( o
        }
9 M8 J6 S' j" s1 p+ S7 g7 Q* ]5 u7 _) r$ R4 [
}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-5-27 17:51 , Processed in 0.014854 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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