设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 5424|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑
) r3 c; e9 G: X& j& ~! p3 |8 F4 X# ]* V8 K
本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21
- C, F1 I6 V: g  I. f3 o$ G以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.4 r$ m) O( y9 p# W# K) X/ g
swarm.SignatureNotFoundException
; ?( J7 b7 B! I        at swarm.Selector.<init>(Selector.java:76)! ]/ H3 Z) s  a" {+ |, Z
        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)
" f! T9 t) @+ P/ j7 K* b        at ActionGroupDemo.main(ActionGroupDemo.java:67)$ |9 _4 L( I; n# f+ {% o
5 J0 w: Z. |1 L6 n. p

' H" r/ A8 f4 t! Z1 Y, t& g" \import swarm.objectbase.SwarmImpl;
  [* U' N# C' T& C8 Wimport swarm.objectbase.Swarm;
- I& ~% K9 `5 H  K+ Q+ P2 m- K# d6 j7 gimport swarm.activity.ScheduleImpl;2 w6 I* O, Z7 k1 i( S
import swarm.activity.Activity;4 l; C* C$ Z: _# g! w& ]
import swarm.activity.ActionGroupImpl;
9 Y7 K! _& N) q3 Iimport swarm.collections.ListImpl;' i- j$ _. I! E; Q: y
import swarm.defobj.Zone;
! \4 ]% W2 J+ l7 w; |: P2 Cimport swarm.Globals;2 [+ a& V* B6 W4 v: J
import swarm.Selector;
& K, O) L. S' r& ^  B: rimport swarm.activity.ActionGroup;
: B  |6 w% A+ k# {. Iclass Agent {! x& u! Q" {5 y' m& w( n
        char id;3 X+ ?  j8 B4 ~( T- A
+ F0 d9 j  M' D( P# H. a2 B( ^# w
        Agent(char id) {
4 F# [8 a3 N. x4 k7 ~* {& K                this.id = id;* K* M7 v" i8 H7 w5 c
        }
. Y" T& `% Q. a4 b- p' f7 x- b/ Q- U! k
        public void agentStep() {1 X: N, a$ O3 H! s
                System.out.println(id + ":" + Globals.env.getCurrentTime());
# z8 S5 O, O0 h        }' g8 k( x0 c, z+ o8 h. K
}2 g) [! G; d  }( a8 Q7 ^6 j

: f; u2 D; @7 e% S! V. Ypublic class ActionGroupDemo extends SwarmImpl {) V; b; E9 _3 R) z+ G
        ScheduleImpl schedule;4 L8 S) d' g* W0 T$ X
        ActionGroupImpl actionGroup;
0 K5 E  t7 Z; @8 D        ListImpl list;
% _+ b5 e) p: T! Q% ]        char Id = 'a';
: }0 _$ J* H9 N( a3 [$ T5 n' p
- D8 p; @% t) z3 E. B        ActionGroupDemo(Zone aZone) {) V3 ~8 G! U' F. K8 e* T
                super(aZone);
# h% a! M; x' e/ B3 x' G+ L                list = new ListImpl(aZone);; \  i& l) ~* V3 x" F! |0 T
                swarmSetp();9 ~& |5 b7 x/ o8 h: n
                actionGroup = new ActionGroupImpl(aZone);7 ?% D( n! P; X6 v
                schedule = new ScheduleImpl(aZone);
( A: x; B5 p1 x/ F                try {
7 L( M: |2 e# n  X, |5 g                        Selector agentSel = new Selector(Agent.class, "agentStep", false);1 A! `! E$ Q& V
                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行
) f# g8 C2 u" N4 `                        
2 L& z4 T/ L3 ?3 G5 T6 y6 J. g                        actionGroup.createActionForEach$message(list, agentSel);
7 j5 G: X# n4 u# Q6 D4 Q+ P9 ]; [                        actionGroup.createActionTo$message(this, swarmSel);/ l4 j" y# T. B; v
                        schedule.at$createAction(0, actionGroup);
4 C7 }9 o3 u, y6 z2 ]7 W# h                        schedule.at$createAction(1, actionGroup);
: |3 L* _( v/ x3 m" c                        schedule.at$createAction(2, actionGroup);; n' B, p0 l) l5 _/ Y+ l( M' `; K# W

4 n% y9 X4 S. k' g7 k                } catch (Exception e) {
% G5 S2 c5 _" y                        e.printStackTrace(System.err);
) j2 Z$ `4 C/ w, o3 E0 f; L: W                        //System.out.println(e);9 D5 ~* ]' j3 G0 V
                        System.exit(1);
8 ]' x- Z4 o) Y- A                }
  ]- f: O; b' Z: `
( M# R2 @2 g: z6 L, B1 I) x9 R4 V' d1 x! I
        }) K- n' k" j: o
6 l2 z! C& ]/ t& ~/ B! O
        private void swarmSetp() {
% m0 Q4 W! z: C) r8 c, n                list.addLast(new Agent(Id));
( u/ q' U* G- a* P  a5 W                Id++;5 a( j' F/ _3 c5 i4 T
        }9 h4 h- H4 E8 d4 s6 R2 y, i& k
* j8 V! {8 l) E6 f: ?% _  H
        public Activity activateIn(Swarm context) {6 ?; g& h) O! R6 b. F
                super.activateIn(context);
0 o4 d( j8 Q$ i. h' g                schedule.activateIn(this);* u- ^0 r; T$ H* n  e9 q3 [
                return getActivity();2 h1 `5 ]: c# T+ \' Y$ y4 E5 ]; A
        }8 K( @, x* |( |" f3 F4 w+ w
5 f, T; g+ y- y9 l+ a- t/ C
        public static void main(String[] args) {
9 _6 |0 ]5 Y( r9 b  x                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);$ F8 W4 o% `! M
                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);
2 t7 J: S) ~  M7 @                swarms.buildObjects();
% g; \# i" G' K2 g                swarms.buildActions();
' V6 r$ ^* a( I; S# d+ w$ o                swarms.activateIn(null).run();+ r% D) c! J  ^5 [6 h4 }
        }; ^- y2 b$ d' m5 V# N

6 W2 l2 c+ L+ T# N' \' m  ?}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-12-8 16:02 , Processed in 0.019186 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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