设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 7721|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑 0 u* ]  d  `7 o: m; d

( e0 `1 d5 D8 G/ L3 l5 u本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21
& [8 r3 ?+ r4 r, A. a: d以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.
' G, N# V8 }8 w0 }. c5 Kswarm.SignatureNotFoundException
# J1 J6 Z8 b) E+ b) U' {* W" e        at swarm.Selector.<init>(Selector.java:76)
' T5 I0 a3 j' j% r, {        at ActionGroupDemo.<init>(ActionGroupDemo.java:37), {* @& x0 t1 g# |
        at ActionGroupDemo.main(ActionGroupDemo.java:67)4 u: V0 O8 D& I

' b1 e$ S* A) @. c  S( U; L$ X
# y- f- l9 F- Q2 C; X$ M4 Cimport swarm.objectbase.SwarmImpl;
8 |" V# o, Q/ c- ]) o+ fimport swarm.objectbase.Swarm;0 H9 G1 \0 k* n3 ^
import swarm.activity.ScheduleImpl;9 D7 Q( t/ W* d. ^
import swarm.activity.Activity;
; k1 O  @2 M$ i& p. |+ t, s6 a. D+ r, [import swarm.activity.ActionGroupImpl;! _( f0 {* _9 \+ ~4 h  k
import swarm.collections.ListImpl;
$ W0 K( l: s. o" ^, p! ]import swarm.defobj.Zone; 6 H; Z) P- D  d6 C2 |" a! c
import swarm.Globals;' g# g* q) I( o% H( c
import swarm.Selector;: e% T5 c+ u" ^/ R  [& F) [
import swarm.activity.ActionGroup;
6 Z) b5 A% H" Z2 O- Iclass Agent {! X4 T, a. R* _  m/ k+ g
        char id;
. E% A8 y: B" e  x) h$ U
% ]% `$ ?; Y+ g1 d        Agent(char id) {' q& ~1 A1 D8 G  w, |6 c' {# Y) N% q
                this.id = id;: S# O7 Q+ u; y
        }- C7 `( y$ w* A/ Q( V
0 V% f4 Q+ J" q% x6 m. T
        public void agentStep() {' R, a0 L' r1 |8 z! P/ Z
                System.out.println(id + ":" + Globals.env.getCurrentTime());
" U( p: o- Z1 g2 W1 S9 u& f        }
. M7 O1 U% ^( K) M8 a7 f# G3 c}* @  C. V# R. ~4 L1 l
0 e( R$ O8 E' q3 M# j1 _- F
public class ActionGroupDemo extends SwarmImpl {- k3 B( \+ i& `7 E7 d
        ScheduleImpl schedule;
9 S6 f0 w$ d0 \/ M% K. e        ActionGroupImpl actionGroup;
* W/ J; i* V+ {( L& Q        ListImpl list;
: r; r) d2 f5 F. A2 c; V( U        char Id = 'a';8 E. I' x8 W/ G0 e4 w9 @5 @

- B' @8 N. O' Y. G6 x% \9 l        ActionGroupDemo(Zone aZone) {% h- j4 b4 D6 l) ]4 g) K
                super(aZone);/ s9 i* [/ J3 c/ U% K) [) e( c; {
                list = new ListImpl(aZone);
+ s' n1 V) J# O! @                swarmSetp();. x) ?0 j" ?! X/ p* p( E
                actionGroup = new ActionGroupImpl(aZone);0 [. ?. I6 `% s2 f* ^
                schedule = new ScheduleImpl(aZone);
- T2 Q. h5 d1 C% t: p5 ?                try {
1 u; O9 M" F6 r% ?                        Selector agentSel = new Selector(Agent.class, "agentStep", false);
. T6 h8 x% b( Q, e' x( t/ q, [                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行9 ]1 w9 v1 a" l1 K2 l( R3 i
                        
+ l- f2 |  m9 ~0 ]) h2 X" A0 W                        actionGroup.createActionForEach$message(list, agentSel);/ t- V1 c$ C2 a5 t
                        actionGroup.createActionTo$message(this, swarmSel);
- z6 W) o  F- h0 k0 D: @  Z                        schedule.at$createAction(0, actionGroup);. l$ H0 ~% M, i& P
                        schedule.at$createAction(1, actionGroup);7 ?+ a& ~* `! a6 Q& Y5 U
                        schedule.at$createAction(2, actionGroup);( }8 [- d4 Q3 d; `- ]
+ t; z; g* O& |8 l
                } catch (Exception e) {
) i8 E* g4 H, i, X- o- L4 x! n                        e.printStackTrace(System.err);( v1 P3 T0 f  ~
                        //System.out.println(e);* y9 W3 u: q) I& N
                        System.exit(1);5 P3 i/ I3 n) ~& @% W' n" t
                }& a9 b* }8 ?4 C9 {
  s7 q2 p; Z, F: |# |( `6 n$ G

( b' i5 [: s  e/ ?  ~( _8 J& {! e        }
. c7 y, \. V! q( \0 I* l0 `3 Z3 O; t9 B% v- g4 m
        private void swarmSetp() {
# N6 F! N! u( y5 O, f# ^6 y                list.addLast(new Agent(Id));) R* G' b) Z" Y: n7 @: M
                Id++;! s* s$ u. K. w& @4 s- ^# K
        }+ m8 I. A' X% x9 F$ |
' Y( f) `5 A) h+ `# b! x* y$ ?
        public Activity activateIn(Swarm context) {
, X( M# |- n; \# g9 j  H( f1 f                super.activateIn(context);2 M! W7 e. v' e
                schedule.activateIn(this);, a* y  n5 ^- {+ R. K/ H5 S
                return getActivity();! X& R5 V- s: v" k' q
        }
& O& E( ~9 v! ]3 O# Q
/ c% r8 I& p2 j% }$ n        public static void main(String[] args) {0 h* G/ Y" x* {1 \
                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);" P1 I4 X1 D: @$ ]3 j0 F1 s
                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);
6 {! O8 R$ Y5 M4 g8 C3 S& j/ W                swarms.buildObjects();
, b4 D4 Y  y" P, E2 m) _4 h( r                swarms.buildActions();, C( c0 N6 I# j: J: s. n
                swarms.activateIn(null).run();" ~( s0 Q6 w0 V% y9 x1 s8 r$ u; r
        }. K. s- `; Z8 y0 m8 t: [. |

) [# Z5 {1 @! x4 p3 H! z}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-3-12 16:54 , Processed in 0.016568 second(s), 15 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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