设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 5880|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑
/ C5 u2 q, I1 r- W4 I  ~
2 y; q- G, ~' r# |/ t本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update211 D. \9 M  O2 w5 o* K2 l
以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.
8 n/ M4 ~, q" u# A: J. ^- Aswarm.SignatureNotFoundException
/ z3 X  c3 c8 u& J; }; V: i6 X9 O. \        at swarm.Selector.<init>(Selector.java:76)
3 g5 m* G; b, J, q: T; U& `        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)0 {- X6 Y# i- h% B6 M: u0 ^
        at ActionGroupDemo.main(ActionGroupDemo.java:67)
: B( Y5 M/ `( H0 x$ e. b/ k7 M5 C; X" l5 W! B, ~: P' M

3 A' g. `8 C0 @import swarm.objectbase.SwarmImpl;$ ?6 A( _, c: Z
import swarm.objectbase.Swarm;
1 z: g3 A0 X! w# V5 Q9 Ximport swarm.activity.ScheduleImpl;
- O) A8 \3 Z8 V  g  i. Iimport swarm.activity.Activity;
) g9 ^; z/ F8 e6 U6 n# iimport swarm.activity.ActionGroupImpl;
$ j2 R0 o6 F6 @/ H( aimport swarm.collections.ListImpl;$ P: H- R: F; N9 V6 Y5 P' x
import swarm.defobj.Zone;   h2 f: d& A+ F! d
import swarm.Globals;: D; _! A, \8 q1 v+ g6 j: v4 t
import swarm.Selector;( g! n4 c% s6 ^. U
import swarm.activity.ActionGroup;
2 H4 N4 U1 x/ I  ^& x! ^class Agent {- h: O3 _: K+ q" _1 \
        char id;
( j9 H( Y; @8 O) I7 d, k1 J+ X. b" L5 _. z' B  f- C
        Agent(char id) {; [5 d: i0 ?7 V! i: F
                this.id = id;: |. h8 b. u3 f/ i% D3 j
        }/ i9 D- l; ?$ I) ^

' @! Z6 O5 m7 w        public void agentStep() {
8 \$ R8 f' S# n9 T. K                System.out.println(id + ":" + Globals.env.getCurrentTime());. U$ M5 n2 X: j4 ]; F
        }
5 l1 Y/ y  v* ?% E) c}0 c# L" a) ?0 C. |3 ?: a) \
- \; _) j- Y0 n! ~7 a% P( e
public class ActionGroupDemo extends SwarmImpl {
- L' z6 U1 t# d+ H. s% j        ScheduleImpl schedule;
( [3 ~" F) s. G0 k        ActionGroupImpl actionGroup;- r$ @% j& G6 `* W. |
        ListImpl list;9 x+ Q0 T; \* X+ z- w& i
        char Id = 'a';+ @4 t$ `/ |0 a& p- a- n  n$ I
* a4 y4 c0 e# B7 j2 Q+ R' r9 M: Y
        ActionGroupDemo(Zone aZone) {
" |2 o0 j: G$ j/ |                super(aZone);
0 a+ E& w# A( K6 L6 t! E                list = new ListImpl(aZone);
$ _4 ]# A9 ^# u! F6 k                swarmSetp();9 A+ t+ ~' ]( ^* M. F& m! q$ I
                actionGroup = new ActionGroupImpl(aZone);
  G3 l6 d2 X6 g1 z3 `                schedule = new ScheduleImpl(aZone);2 H  b- J" ?9 ?: ^& b7 j
                try {$ U7 t- C: R$ t# h; h5 d
                        Selector agentSel = new Selector(Agent.class, "agentStep", false);% n! ^8 d0 L. K1 c- [
                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行
( V# p) K$ v2 O/ n                        ; M# h- F& G2 H% C3 ?- x1 d
                        actionGroup.createActionForEach$message(list, agentSel);! \8 F. {0 k; b; O6 v
                        actionGroup.createActionTo$message(this, swarmSel);
& o6 F4 S$ @2 g8 k                        schedule.at$createAction(0, actionGroup);
3 e3 H" u& K2 J                        schedule.at$createAction(1, actionGroup);4 t- V# x5 [8 @) q
                        schedule.at$createAction(2, actionGroup);
8 H6 Y7 t. \- P+ O1 y/ J$ i9 J: b: ^6 M
                } catch (Exception e) {
6 a( ~/ H6 c' V, S                        e.printStackTrace(System.err);
) H/ f' L4 ~& W. X9 T; ?                        //System.out.println(e);( m- ?) r' B4 w% N
                        System.exit(1);' ?6 m% Q, J( j/ ]' w7 A
                }  x% m. d7 d( F' _) i9 _8 W

0 v8 O4 F0 C5 V" _/ u  Q
- k, `8 F+ Y1 ~0 U        }
) u( U3 N2 X  W$ W+ f0 C/ w9 V- {$ I6 @- g; u* }
        private void swarmSetp() {9 \3 p; Z/ L0 J' W3 Z( _9 _
                list.addLast(new Agent(Id));0 }* r3 z& g( c7 L
                Id++;
2 ~( L$ \6 j5 c( T% M( v        }$ w$ `/ y( Y" b/ r7 `
% N7 C- R$ i1 m& U! C! B7 B( M
        public Activity activateIn(Swarm context) {, Z2 {( t% ~  ?8 `% q. C8 Y
                super.activateIn(context);
: i- }4 B- f3 |) J( {                schedule.activateIn(this);
2 r5 w; L6 t, Q- _7 G                return getActivity();0 F9 K; @, ^8 D; b
        }
8 \% V6 a1 n+ w4 q  w" X$ f0 {2 t/ m$ y: ~- Y; ~  E
        public static void main(String[] args) {/ B& h" u+ r$ ~, w
                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);" J* I9 }! P% f+ T9 G! H
                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);" u. C5 E$ P6 A0 T4 T! V
                swarms.buildObjects();
9 l5 z( t8 [6 n1 r1 C% P                swarms.buildActions();( x- s& Z* L6 |8 O$ ?3 B- W9 m4 q
                swarms.activateIn(null).run();
/ A1 t* x7 X+ Q        }# P- `$ S+ q. C
0 n2 p4 o0 D# }- {8 l" ]4 s
}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-1-2 21:01 , Processed in 0.018045 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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