设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 10114|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑 . s2 }1 q( a' @

2 s7 c% j% {+ _本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21+ ?* _3 K, P- V/ ?
以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.7 v: J/ n% }/ ~5 I) Z$ q2 l
swarm.SignatureNotFoundException
5 n4 Z7 y5 X. I- x% o0 Q. A        at swarm.Selector.<init>(Selector.java:76)
. \8 J/ N% ~1 i- A        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)
- R; k$ a# ]& _* {" G6 A! N: O5 V        at ActionGroupDemo.main(ActionGroupDemo.java:67)
' g! R. z' O9 ^* j( b& N
3 T0 |+ J! Z1 Q3 r  l' d1 p- c! d; _" l
import swarm.objectbase.SwarmImpl;: n& _( Z& q5 @3 k) C7 {7 ?5 I$ k4 {
import swarm.objectbase.Swarm;
9 a! Z0 @3 H3 V- _* V/ I' h3 \* yimport swarm.activity.ScheduleImpl;
0 j- Y; T( p+ kimport swarm.activity.Activity;
( }3 g2 L' o8 N, x9 oimport swarm.activity.ActionGroupImpl;
% Y/ H. l" t  ^: ?6 X( Timport swarm.collections.ListImpl;5 z8 S- F# T( R( {* R0 |% z; l
import swarm.defobj.Zone;
* Y4 T/ J( v2 h/ Fimport swarm.Globals;
1 V8 n+ D" T8 \$ Q4 X6 [import swarm.Selector;4 O1 f: ~2 V0 x  D* p
import swarm.activity.ActionGroup;
/ Y6 z( I9 i7 s+ l7 Jclass Agent {9 g: t9 }/ ^. G' x- o
        char id;* c1 V( N/ h2 _

# e! i7 i* |1 q1 K( k6 g        Agent(char id) {& V# j& _" O3 i7 o" t- Q$ ?5 _" ~
                this.id = id;
/ Z4 l: L4 I, J- ~  Q1 Y        }
0 d; g% d# C+ k6 Q- i
5 O" L; g4 R; W( J3 G7 s        public void agentStep() {1 Y! i$ [7 U$ S0 L7 p
                System.out.println(id + ":" + Globals.env.getCurrentTime());5 [( s  a- n; `7 y$ o0 P
        }% D$ n  e9 q  P, n0 B
}9 u5 T0 ~  K  e( k
6 B$ H- _, b$ ~9 C
public class ActionGroupDemo extends SwarmImpl {" N% |0 w' L' v& o2 W
        ScheduleImpl schedule;
* o* G% I8 c: ]3 l  t* b        ActionGroupImpl actionGroup;
, f* T, H% l3 A( i( Y        ListImpl list;) E1 Z3 y9 W8 {7 l! ]8 v6 s
        char Id = 'a';" R. M! c9 Q2 r) u5 \8 o2 t

$ R, _& m! j: [) r( Z# S# A        ActionGroupDemo(Zone aZone) {
$ `  s0 G! c' ^7 \3 O                super(aZone);
6 o+ ^1 F; M/ C! m2 H* Z                list = new ListImpl(aZone);" }1 K0 W( [* W
                swarmSetp();
1 e/ I4 d& ~. V$ D* {                actionGroup = new ActionGroupImpl(aZone);6 h# w% G4 U! h0 N( p. c+ _4 l
                schedule = new ScheduleImpl(aZone);" x; h8 u5 Y% `9 }1 J# G) `
                try {! G3 l; A$ a, j' L! U
                        Selector agentSel = new Selector(Agent.class, "agentStep", false);2 V5 M6 v2 a* c/ O( {1 E
                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行
  C4 A* Y6 u- u) O. W; @                        2 @* T/ Y- @; j) v9 B% F7 r4 @' T
                        actionGroup.createActionForEach$message(list, agentSel);0 k/ q" ~! k: w5 g
                        actionGroup.createActionTo$message(this, swarmSel);
. k5 J6 v" |: K/ D! J                        schedule.at$createAction(0, actionGroup);3 Y0 }7 U- E" ^7 ?8 }0 J: N& y
                        schedule.at$createAction(1, actionGroup);3 y/ ?. r9 P- s  M
                        schedule.at$createAction(2, actionGroup);
, j$ d6 w* D5 O: k% G, V) ~0 \/ B
                } catch (Exception e) {( o- ^2 `& }: E
                        e.printStackTrace(System.err);' s& K& ^( _7 H; j& d" g8 c3 k
                        //System.out.println(e);
+ o9 h* \. b. g% ^                        System.exit(1);1 U; T3 F- N# E4 d/ B0 \
                }) n$ k" K7 }+ U, L* Z
3 j  B) K( r9 x

) [7 S5 n, R1 E8 C/ c        }
( g+ a0 A& S; i) E$ `% M% \  ~8 E8 l
        private void swarmSetp() {
9 E6 E+ n+ B2 S# B1 e$ O  b                list.addLast(new Agent(Id));) w# j( [2 e0 b/ a/ u; n5 ?1 K
                Id++;
* d. V8 K0 t6 I  \% M        }3 t+ ^  Q( q( R8 y7 V
6 {5 S# g' w, D" @
        public Activity activateIn(Swarm context) {$ E% h% j& t: r2 [/ o, |5 L* ^+ `
                super.activateIn(context);
( i8 R/ d* y; f# c4 n                schedule.activateIn(this);! H3 d: D$ d5 j) }$ {; P
                return getActivity();
( A7 f0 _% O5 Q' }9 r        }: i" r# a1 l1 x
9 T/ T5 i) ~  Q8 K0 @
        public static void main(String[] args) {
4 y$ B8 `% v# `1 k; u                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);
+ Y3 c" t1 n6 r3 r* f  D1 f                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);# P$ k7 Q0 `/ u+ K* @
                swarms.buildObjects();9 R2 _/ g7 Z' Z0 i; d6 C
                swarms.buildActions();1 i# K! C/ h' r4 i  }
                swarms.activateIn(null).run();. }2 B9 q1 D5 h& G4 X' {/ ]
        }2 Y( j/ d# [/ R' i# X+ Q
$ r7 I1 ]' e3 ~: p& S+ C
}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-6-4 04:26 , Processed in 0.014186 second(s), 15 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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