设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 6225|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑 ; O/ g+ c) W5 B" w6 \6 _. q/ U

" {) Z$ `9 e, X' y( o本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21
. Z" l* N( @9 X  ]# C# {* P以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.
2 B2 C8 x3 G: x: Q3 @swarm.SignatureNotFoundException
/ E4 W: |+ U" K% W) X. C: i        at swarm.Selector.<init>(Selector.java:76)
$ t& w$ L3 w2 A$ ~8 [; }: Z        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)
  z1 r: d) L1 m, N) @: ~, S, P        at ActionGroupDemo.main(ActionGroupDemo.java:67)+ W5 p4 B; i; x( o6 f' G: W* N; n
. k! ^0 {, j, ]2 Z; g& ~

; q: c7 A6 L' j* Rimport swarm.objectbase.SwarmImpl;
$ R/ I& n7 \0 Z+ t2 I# |4 Ximport swarm.objectbase.Swarm;
2 U7 C$ n& w) O* X" V: X% M: aimport swarm.activity.ScheduleImpl;
7 H' s4 A0 G) }import swarm.activity.Activity;; ~1 v9 B' A$ H
import swarm.activity.ActionGroupImpl;1 u4 q; ~! n& i: j! r5 c, Y/ e7 y
import swarm.collections.ListImpl;
& L2 i5 _/ b" m; C! timport swarm.defobj.Zone; ' d' D9 U( F2 f0 D; z
import swarm.Globals;# o, G) A" ?" `. n
import swarm.Selector;2 E) `  K% ~5 S  e1 U" E
import swarm.activity.ActionGroup;
7 s$ T6 i( K1 E5 i+ mclass Agent {1 ~% P' h8 _2 u% A1 I
        char id;0 N$ m9 `( ^6 H* b) A5 q

; y; p+ H9 _, @        Agent(char id) {& d. I' c2 r# }/ z( c* c9 b
                this.id = id;
6 S8 E, R7 e! ~* V4 g" V        }
9 f) G) m& ^# W8 f2 n  e# U" j) D- D# c1 N1 V9 d" o
        public void agentStep() {
' \, M' I) E- p$ y                System.out.println(id + ":" + Globals.env.getCurrentTime());  V) H$ y+ U. s, u0 J" |
        }
& C# K6 Z9 o: i: O- Q6 H4 Z( Y5 U}! p* E/ l# [, h
# p0 C/ u5 `5 H$ E, M- O
public class ActionGroupDemo extends SwarmImpl {1 t1 I( j  k5 X# w9 r
        ScheduleImpl schedule;) P. E; V, L6 x& c& R2 D
        ActionGroupImpl actionGroup;
/ w- ~% t7 V# h! ?  g7 P1 i        ListImpl list;# U% V1 c6 D, q0 e
        char Id = 'a';
* d. R; T, F  \. _( A1 q
% g/ y5 o5 X3 U( }; Y3 K1 d$ O9 y        ActionGroupDemo(Zone aZone) {7 x% ]6 M* C5 Z/ l' o& a7 }  C
                super(aZone);/ N4 J- h+ C( N8 J# F7 R  D- F: ?
                list = new ListImpl(aZone);  N- m% @$ V& V0 a4 U- K2 P% M
                swarmSetp();! K4 M  Z+ n" I" J/ V4 ^* o' e+ f
                actionGroup = new ActionGroupImpl(aZone);. R. \/ _4 L6 n! I) g" S& M) X5 t
                schedule = new ScheduleImpl(aZone);1 \/ p- ^3 s! B
                try {* d9 L, |, D; T, j9 y
                        Selector agentSel = new Selector(Agent.class, "agentStep", false);) g) }. W; T+ b& Z& m( Z' k
                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行
. _; ~3 ~- `1 u" c+ j; {7 w                        
! _. P& J$ o9 q' l! I# J                        actionGroup.createActionForEach$message(list, agentSel);+ E3 K# Z5 T* H8 M+ b+ q2 R% Y0 D
                        actionGroup.createActionTo$message(this, swarmSel);
2 b- f1 D% T& v  A* {                        schedule.at$createAction(0, actionGroup);& D) C, L! h" K! p4 _0 U8 @6 M
                        schedule.at$createAction(1, actionGroup);1 l! p) @, Q% w& p; N& w
                        schedule.at$createAction(2, actionGroup);
: d; d/ P2 W8 A; d4 N( u/ p# Z2 U0 N- D- [6 U: V4 t5 w
                } catch (Exception e) {* {. o; i1 b7 ?) ]' J
                        e.printStackTrace(System.err);) y0 G; R& c/ S" w9 f& x, ?
                        //System.out.println(e);
) I) [$ H" T' [- d                        System.exit(1);
* J, V$ d4 s' w8 }" o- i. x4 T! A4 q                }
" O. x* @( Y, d: a* v9 j: S% g, l% U* }
; ^& g7 N1 [$ I* g9 p/ N) I7 L: M6 W
        }
( {  @' H4 j/ N0 ^0 Z; q" Z6 T4 ?
        private void swarmSetp() {
! B2 X6 N5 b4 A                list.addLast(new Agent(Id));
! C) b& W6 B& Z- M                Id++;
8 E/ t) x$ M% H) Z) _        }
5 u9 r) I' T' O; @* k
! F! O. K8 Y  L& u) h" x        public Activity activateIn(Swarm context) {# |6 D) I: T/ J6 t8 D/ {9 o$ r7 B5 t
                super.activateIn(context);
* _! `0 t: _4 ]$ }9 u+ [                schedule.activateIn(this);( G2 |9 u% u# a! G
                return getActivity();
5 R8 f1 @6 @5 I5 U" ~0 i" u6 S        }% Y# I3 t% M- O( c2 f! L

7 G) J, Y& f% O; T# g" _% `$ K% U; y" H        public static void main(String[] args) {
  H6 T" X+ X( }+ D* B                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);
* Y, ^. R' J, L' z; ?+ ]$ \: M' q9 f                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);
4 H  w3 A2 Y5 c# Y, q0 g                swarms.buildObjects();
0 y8 K5 e+ h: E& i/ ^3 y                swarms.buildActions();
: v7 W9 Y3 C8 a6 u4 ]" d5 x                swarms.activateIn(null).run();
/ C, C6 D9 r; k) Q        }7 t1 a* U  \/ W/ r  q# T2 V7 X
5 {, t/ m8 y$ W2 v' ]+ B$ n  l2 G/ {) B
}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-1-21 22:51 , Processed in 0.020168 second(s), 15 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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