设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 10454|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑 . O# p- a* G2 f5 Q& ^  K
; X5 |$ K) h# [- Z$ u/ Q1 x
本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21( ~8 T# }: Q, ~% Z: g
以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.
6 G( b/ Q8 w- g9 u1 S! ?swarm.SignatureNotFoundException
' a; d4 w/ J) S9 e- V( O3 u        at swarm.Selector.<init>(Selector.java:76)
1 F  u, y) L7 D        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)
& b3 n* i! g1 B9 v- f        at ActionGroupDemo.main(ActionGroupDemo.java:67)
/ n  k7 F4 c: x# C0 r- T7 w& t; s3 c$ v/ _  L% r
9 D- P' K  ?5 J7 C9 L  ~7 I3 Y
import swarm.objectbase.SwarmImpl;
8 P3 E' j3 {5 M+ p7 ximport swarm.objectbase.Swarm;" |+ m1 l9 J" r" e6 J
import swarm.activity.ScheduleImpl;
/ T8 D. e7 ]1 t) s2 K9 Simport swarm.activity.Activity;
( @1 q; B/ W+ mimport swarm.activity.ActionGroupImpl;
3 C0 Z3 g9 s* p& f0 C9 {. x9 Qimport swarm.collections.ListImpl;' a1 X6 I, B' q& U
import swarm.defobj.Zone; " t  q. B+ i8 z. b6 c3 [
import swarm.Globals;/ H/ c% T, {7 t/ a6 R
import swarm.Selector;' m4 P% Q  G2 z% K
import swarm.activity.ActionGroup;
6 a2 `' i$ y0 o; a" K4 Qclass Agent {9 r* q" e' Z' R2 W6 `$ m2 A) E
        char id;8 H0 s8 D% p& Y8 i1 v) R. u- t
( p6 U! M7 l, {
        Agent(char id) {$ \# H! N0 O$ e: |
                this.id = id;, I4 C* \- l1 D5 b1 U4 C$ f) g
        }
& z* h5 @7 L$ y8 z" A
& _" o3 B. l4 e( F- Z7 `        public void agentStep() {$ }6 n% ?; D( Z
                System.out.println(id + ":" + Globals.env.getCurrentTime());
% L% \" d# W3 L  y* t" i        }
+ Z  R1 }7 v2 T/ u. h}! Z  r" v. A/ e# A5 I" H
2 g0 k* o; j7 m3 O
public class ActionGroupDemo extends SwarmImpl {
0 w6 _1 o" ~8 I- d% ^7 a5 V        ScheduleImpl schedule;$ b3 D3 w8 ]. e: {- K* c( M. y' Q
        ActionGroupImpl actionGroup;
. I" n2 l8 w6 A. v; e        ListImpl list;
5 h* G1 Y! B9 v- Z        char Id = 'a';* i, X0 G6 c( Y! |/ F9 Q/ W

/ \+ L% g' z/ f: o0 v        ActionGroupDemo(Zone aZone) {# d6 D0 Z  I% r
                super(aZone);
0 A4 Y3 m$ K1 B1 x# e                list = new ListImpl(aZone);
! S% m& G$ b4 z9 A$ d. m& Z                swarmSetp();! I! @$ V6 u, A' @* Z+ |
                actionGroup = new ActionGroupImpl(aZone);- X/ J) I5 e% n& K5 Q9 V! ^  K
                schedule = new ScheduleImpl(aZone);: ~% G( @4 R2 `
                try {
. I: q4 G# K3 `, B8 _( c  d+ P                        Selector agentSel = new Selector(Agent.class, "agentStep", false);
. z2 h; ~% o* y5 F6 J& k. t                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行
; D2 Q5 V1 W9 h# R8 _* t                        
8 E% h5 L: A# S' ~$ q* R                        actionGroup.createActionForEach$message(list, agentSel);
0 F7 {3 Y) h: c$ _# F                        actionGroup.createActionTo$message(this, swarmSel);
. X% h) O8 i1 u7 |& f& s                        schedule.at$createAction(0, actionGroup);( ?3 [5 d4 k9 V! [! U+ r8 o
                        schedule.at$createAction(1, actionGroup);
4 ]- X4 p4 X5 P                        schedule.at$createAction(2, actionGroup);) Q# f2 n  V9 P3 p% c
6 _7 }0 d- l0 x( x0 N5 R/ g
                } catch (Exception e) {' s1 C( ~% {8 ^. L2 H; ^  T) o1 E3 Q
                        e.printStackTrace(System.err);( Z" o7 g2 ]0 J
                        //System.out.println(e);
2 |2 X4 W9 l9 z4 R& m8 l% j                        System.exit(1);
8 o7 d8 c* e9 L; f% N( ^                }
$ v2 }: V  _9 k3 d( V7 U& k9 B/ F+ R$ m) ?4 ]. U/ o8 L
+ |" N. `; E: U3 Z
        }
4 m) D1 g0 n# z+ k6 r3 J. b
  Q: J0 ^+ \7 K$ L        private void swarmSetp() {
# o: m) c- ^; @- K4 x; D                list.addLast(new Agent(Id));
( |! ^9 a+ v$ E$ C% {, t9 l                Id++;3 j# ]: F- f0 M# ~& X" s0 L) [
        }
5 s& j; w: U5 G. O! E& a( ?+ }
0 o7 H9 _; N( b8 U; p  j        public Activity activateIn(Swarm context) {8 l2 b; x# f& F: u
                super.activateIn(context);  F, [3 X2 B; b2 D+ f1 ^6 l
                schedule.activateIn(this);
, w# }0 d* s% _% W% I                return getActivity();
9 e0 I1 s1 W; y! m! p6 V        }8 C- g/ l: `8 h2 o) t* Q% Z

7 q+ g7 x& E0 R0 s        public static void main(String[] args) {" a% V2 r" N* Z" d, ~' D8 V- ?
                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);
, y) K& J' a# h$ {, H                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);
# G* S: I- I) @. t3 b& ~+ B1 G4 \6 m                swarms.buildObjects();0 D. G- l+ W- ?0 h6 u6 [0 D
                swarms.buildActions();
7 m) [* R* S5 f" v0 M/ d                swarms.activateIn(null).run();; I- b1 Q9 c% |# t' p" M' Q
        }
7 s7 n* W7 S# ^4 r$ t
! d2 p, u6 `$ I( A; L1 c7 q}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-6-14 16:03 , Processed in 0.017594 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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