设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 11171|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑 8 ~( @+ Z$ m; F* I4 z+ A; v

! b1 }5 |& a7 Z. l$ _" H本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21
! k+ k8 B# f1 m$ s; K; m) b' r% s以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.
. M9 x6 r4 {1 R& Qswarm.SignatureNotFoundException
2 A/ l, D4 c. t+ }0 W' X/ S/ Z        at swarm.Selector.<init>(Selector.java:76)! |% Y3 z; U9 g
        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)
% s6 a! J; N: p- N/ c) F' z        at ActionGroupDemo.main(ActionGroupDemo.java:67)
/ b( O$ @' x; ^) l
7 A5 V5 F' i& t0 s1 r  F& x7 |  x' i' a' d
import swarm.objectbase.SwarmImpl;
  w. w' J& g( r0 T( h3 Dimport swarm.objectbase.Swarm;
2 J# t* o4 F- N7 {) Zimport swarm.activity.ScheduleImpl;- I4 `9 j. P: o- W4 ~! A2 `
import swarm.activity.Activity;$ [, x) {' D5 P0 o+ C
import swarm.activity.ActionGroupImpl;
2 t- H( H, T0 ^; _$ W/ m- Gimport swarm.collections.ListImpl;6 t3 H# z  E7 v/ J+ [% U, n
import swarm.defobj.Zone;
1 o9 E2 Z0 g0 _0 |1 Fimport swarm.Globals;6 x) N1 y; z. S( U7 O5 Z
import swarm.Selector;' A, \! |( H1 m) B7 J% I
import swarm.activity.ActionGroup;
* g. t5 V" M+ E* E7 v3 tclass Agent {
- t8 x3 {; s, S" p" c  u6 ~        char id;. k$ p* ?2 Y3 Q7 O( R
, [6 s3 g  v8 j1 R! h
        Agent(char id) {
: ]2 T1 L+ Q9 ^" i, a, W7 g! m3 j                this.id = id;
8 ]8 N  ^) S! A        }
: ]" \+ j( ]2 l3 a/ S' U/ d! x9 ?8 \, t& e. W, t
        public void agentStep() {) {7 [) @# J$ c% d
                System.out.println(id + ":" + Globals.env.getCurrentTime());
: u! e, Q6 C6 Z! e        }
3 m: e- p$ o+ n; d6 {}0 l# i, P0 Z% X! g

, ^5 t2 f3 k$ h! Jpublic class ActionGroupDemo extends SwarmImpl {& F* C0 a7 {3 q6 }: u- }
        ScheduleImpl schedule;2 G4 `( P  ^! `+ ~( W5 i
        ActionGroupImpl actionGroup;) {7 w. h- w1 ^+ M* {
        ListImpl list;
2 a6 u' ~5 t" n! Z2 X  V        char Id = 'a';
, C9 \* _3 A( ?5 }( X' e% k8 N; V. [. h) X
        ActionGroupDemo(Zone aZone) {
. e: L6 H. ?3 o0 C8 E( m                super(aZone);
9 s7 O9 Z7 y$ v3 f8 t                list = new ListImpl(aZone);
0 |* q, f# s; `% }) o                swarmSetp();% O6 |. R* h, f, W6 B. E
                actionGroup = new ActionGroupImpl(aZone);
/ S0 b6 d! v* h8 o0 f' C" [                schedule = new ScheduleImpl(aZone);
/ |5 c) o0 ~, l                try {! a! x7 p4 ?& X" ?
                        Selector agentSel = new Selector(Agent.class, "agentStep", false);
$ p& M& |& F' ]( n6 e; Q                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行
& E) t; v5 `) }. X) y5 R                        - G6 F! d  N, X; \- b/ V' N& s
                        actionGroup.createActionForEach$message(list, agentSel);' o) q( y) `  w' a, U
                        actionGroup.createActionTo$message(this, swarmSel);4 q, d6 n: ?( h! {% E4 h! p
                        schedule.at$createAction(0, actionGroup);- i% Q) i, M6 ]3 M6 [
                        schedule.at$createAction(1, actionGroup);* Q6 |! f8 K: O0 s4 m
                        schedule.at$createAction(2, actionGroup);2 k" B, o) W/ t8 j9 |' Z$ p( _

1 P+ e9 [' `( D2 D                } catch (Exception e) {
  c9 O0 D- ^1 l/ o% _7 S                        e.printStackTrace(System.err);
0 v$ _2 ]4 z# B0 G! a1 F                        //System.out.println(e);' g8 y, ]/ B* ~. E+ @5 |5 @
                        System.exit(1);( d. `1 n& j; U5 @! `
                }/ k2 L, x+ r: R9 ~. e* t- P
6 M3 A8 E8 S% b6 c9 k1 Z
2 e0 [* O) U5 S+ ]
        }* g, f$ @! L6 H' @
0 H* B% h! W6 H% G
        private void swarmSetp() {: z1 Q( ]$ Y, I7 m8 B- {2 Q+ F0 Z
                list.addLast(new Agent(Id));# v$ ^9 O5 I( @, l4 F0 Q- K
                Id++;
0 Q) M) p2 `- N- L* l- G' l        }
# D/ ], B; q; t- Z5 F; F# j; C& X2 P, r# d, q( l
        public Activity activateIn(Swarm context) {
' S; ^, _( d2 f# s! K( \, r                super.activateIn(context);
2 W. j0 J9 @7 k) _  ?                schedule.activateIn(this);: w, y- Q0 P8 D7 g3 L
                return getActivity();
1 m& o$ d, O* ?2 O/ A        }  w# Y" u) L. W; k: U

* P$ B$ u: b  w8 {/ x1 o        public static void main(String[] args) {7 ?7 ~& Q0 h) U9 O/ d
                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);
2 q- W) S% Z5 f" T1 V( t                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);- I- w2 e& M2 S7 b$ G
                swarms.buildObjects();
6 ]5 ^8 D' N- Y+ h0 \: C( f" h                swarms.buildActions();8 j. {3 ^$ k" e2 p, ]% x7 h
                swarms.activateIn(null).run();1 B! I" b& D- D2 j9 x+ u
        }
9 i6 R" b0 C* _+ `; [' _$ o
$ {& @% P3 X0 M0 B4 X}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-7-5 04:19 , Processed in 0.022740 second(s), 15 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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