设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 13736|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑
& Z: U8 j- C  j
$ A! M' Z" `3 X  ^  s本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21( E% J, I& }( A
以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.; B" \- {; @. p9 v" g
swarm.SignatureNotFoundException/ V- F) v3 O5 g1 L$ y; Y- c' u
        at swarm.Selector.<init>(Selector.java:76)
: J7 q( ?6 c. }) B* C% e) s        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)
& t4 Y1 K. o1 Y# X3 u0 g        at ActionGroupDemo.main(ActionGroupDemo.java:67)
8 o" a$ N% X; Z# z# Q* P' \
  G6 w8 t2 o1 u: }! r
7 {& z8 H% I( T6 C: X2 j% Yimport swarm.objectbase.SwarmImpl;/ _& J& A9 n1 H% G$ X
import swarm.objectbase.Swarm;$ L8 B* {& a* C2 \
import swarm.activity.ScheduleImpl;
9 P- _9 c9 Q- c: L0 aimport swarm.activity.Activity;- B6 b+ G2 ]3 P$ s, C% {; b) ~5 x
import swarm.activity.ActionGroupImpl;
/ R8 x: G; x* n( y$ Cimport swarm.collections.ListImpl;
! a1 @. w/ x" w6 h/ e" L, Q- Simport swarm.defobj.Zone; 3 q3 y% w/ L$ L5 S: |
import swarm.Globals;
$ V3 Y2 `: s, x+ V& e% Uimport swarm.Selector;" h6 K1 ~& E3 E" p: m" C
import swarm.activity.ActionGroup; # o" g0 a$ c$ ]
class Agent {
9 R; M* [# w8 \$ |& e  u        char id;
! P* W, [5 J9 D/ _# n
0 i- m6 A# [8 K, o. V, L& v+ r        Agent(char id) {4 S( q4 G/ j* b; C2 B/ X9 S
                this.id = id;
: ?/ Y& O* M% @; Y7 {        }9 F. _3 A5 h, C$ a
2 J1 I; R' ?; X8 _
        public void agentStep() {
( d: T) J1 Y7 w1 N! K1 c5 L6 K                System.out.println(id + ":" + Globals.env.getCurrentTime());  E9 p# A2 V7 f$ B. Y1 s
        }
5 K! L( W) L/ Q/ o" U4 n}1 ]. U  m7 q! A9 W  [1 x! M1 H

9 L$ w: v7 ^/ E% Z" D( vpublic class ActionGroupDemo extends SwarmImpl {
2 }4 n8 I7 V8 y3 s; D9 Z+ s1 k' C9 l        ScheduleImpl schedule;; l- G0 N1 i5 |  ?* x; U
        ActionGroupImpl actionGroup;
1 r* ]/ l$ t' w& X- U/ o! V        ListImpl list;
5 ?. B7 {! q7 Y* ^! ]* E        char Id = 'a';  t$ _9 m+ |# V1 F2 y: w: {$ @
& N, s. d* l7 ]' V& [8 t3 }- k, _- j. }
        ActionGroupDemo(Zone aZone) {: b( r; ~/ I5 @; o% V6 f
                super(aZone);
3 ~: ]! s  @/ L5 _. a) h; B                list = new ListImpl(aZone);
' X- |- K$ s- j# ?                swarmSetp();' q7 U4 F8 R+ \6 I' a
                actionGroup = new ActionGroupImpl(aZone);
0 t9 f9 o$ m) x) |                schedule = new ScheduleImpl(aZone);; E! h/ R$ w, t% [7 m9 i
                try {
! H9 B% H8 r1 b) a& @/ |                        Selector agentSel = new Selector(Agent.class, "agentStep", false);, y! P& X! J8 a; H" |9 [  [
                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行1 A: m' z4 {/ S6 J  ]
                        4 I3 d1 L" w3 O- e" K
                        actionGroup.createActionForEach$message(list, agentSel);# N& k7 Y! i- O8 H) [7 J; N
                        actionGroup.createActionTo$message(this, swarmSel);
1 Y  j  h0 |8 V8 ^6 ]( a8 l! x                        schedule.at$createAction(0, actionGroup);. P. L0 ^: ]: \; H5 [7 u
                        schedule.at$createAction(1, actionGroup);0 n; c& r+ A+ _5 n7 i$ \: y! ~
                        schedule.at$createAction(2, actionGroup);- f1 T4 t5 W- u& U. l1 Y
# T. @) n9 _: p2 E8 A
                } catch (Exception e) {2 @! h" R' I- ~5 C
                        e.printStackTrace(System.err);
( L/ _3 N# @0 `7 I: q                        //System.out.println(e);+ b* A+ x. Y' w1 F# k! f9 ]3 ]
                        System.exit(1);
0 L9 X& _# _: R# x. y0 u$ ^                }# ], x6 n2 D4 L% o+ E# q+ R

1 i$ }& G2 n  ^7 V5 p( u( z: _) H3 g: y4 n% Z% J& W6 h
        }
4 b) H$ d2 y5 L# t3 h7 w
4 b; `- K5 }  I9 \1 w9 `* ]! M) J        private void swarmSetp() {9 N2 t3 C( Z6 T
                list.addLast(new Agent(Id));
, \$ f) x% Q2 Z, X$ I                Id++;
+ m4 ~. O# y1 f+ M( F6 B9 ~        }
6 m. J; u. J, |7 J6 u6 A5 ^
# V6 w6 k9 ?1 n" v6 v7 w1 M        public Activity activateIn(Swarm context) {
( A( |" B4 y' [0 E; U! r                super.activateIn(context);/ t" Q9 w; |: ]4 X, f) H6 B# k
                schedule.activateIn(this);
7 ~0 R+ k4 K; j                return getActivity();8 N1 I' Z/ V& T) [9 B* M8 ?
        }* {5 }/ q2 U2 v" Y8 I, P( s
1 S1 x5 L& M3 i( I6 ^0 U
        public static void main(String[] args) {
, S) I" h/ G+ g) }                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);: N$ l# d6 Y; W8 D" W) {
                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);
6 n1 k, Z8 g3 U3 {' J# d& T* {3 s/ c                swarms.buildObjects();
" ?+ }' m7 Y( ~; }( e# ]' C. X( B                swarms.buildActions();
  S* w( t5 L( E8 R- O% Q                swarms.activateIn(null).run();
* U8 z9 ~6 P/ C1 j        }
8 f. J! F, _& ^, ^
: A. G* ?; [* h}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-9-16 01:30 , Processed in 0.016343 second(s), 15 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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