设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 5404|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑 " \7 H+ i* V/ H; q+ O
0 b5 y+ t8 ~- W2 T7 h: B
本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update218 M. K1 t+ j5 O+ x" P  x
以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.! a" }( I, r0 \3 Z$ X
swarm.SignatureNotFoundException
$ x6 j+ q5 ~: v' p2 H        at swarm.Selector.<init>(Selector.java:76)
, S  t0 ^  P- Z( Y+ x) h        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)
( K) u2 y: |1 \8 j+ N3 X        at ActionGroupDemo.main(ActionGroupDemo.java:67)
! K9 N9 u+ k8 U" M# y" w( \
+ Q7 S5 t% Q( T  w
/ M( B  S6 u8 ~1 a$ a8 Mimport swarm.objectbase.SwarmImpl;
  X# b; H1 x" g4 uimport swarm.objectbase.Swarm;
9 [9 D+ W0 _/ L; o0 Limport swarm.activity.ScheduleImpl;
( \* q$ q" d6 Fimport swarm.activity.Activity;3 E# U9 p7 p0 Y5 l9 ?6 |- h
import swarm.activity.ActionGroupImpl;
1 q' u. T( H! e) simport swarm.collections.ListImpl;
4 K  x, A4 K8 {  yimport swarm.defobj.Zone; # r% f$ ?& A6 D2 [1 f  M! X
import swarm.Globals;
' ?# B- X+ k+ i5 |7 r4 W8 uimport swarm.Selector;5 |4 ~. R# e3 g5 L8 V
import swarm.activity.ActionGroup;
* L% C% z' j# ^8 E) {- d4 s- o3 Uclass Agent {2 U# e3 d% q' Q8 l! \) O
        char id;
9 Z& }* z( P5 T' D& m9 T# V4 y/ |* g, C3 K! i
        Agent(char id) {
( h3 [% N/ G& f1 J                this.id = id;6 a3 ?/ |2 `7 j4 l/ M( O! @! r
        }
* Z- [, `( d& K1 T9 E0 x6 I
9 {3 B+ T; k- g0 k9 K8 d        public void agentStep() {; d- ^5 J) n4 J% C. A6 H
                System.out.println(id + ":" + Globals.env.getCurrentTime());& u7 E8 K8 j. s+ h* o: @
        }
( S, W) \  X8 x0 R}- n( Q" `/ l4 S" D/ V

$ |3 V. O9 M5 ^" |! t! ^$ `public class ActionGroupDemo extends SwarmImpl {
' P. Z4 J9 i) s0 Y" m8 A" I- A% |        ScheduleImpl schedule;
/ W$ K, u4 ^; S/ e' n$ N1 u        ActionGroupImpl actionGroup;
1 F$ W+ a  n) F# t# ^, x6 m8 v        ListImpl list;: L$ G( c* E" \* {5 `" k" f
        char Id = 'a';
4 L8 Y( v  g( [# ^& R, n4 W9 N
9 I- x6 h- J: A* |/ o        ActionGroupDemo(Zone aZone) {
9 x/ h+ H2 W  |, F( S& H                super(aZone);/ m1 }, j2 f# I/ F
                list = new ListImpl(aZone);
0 j) A( {& t4 ?2 J                swarmSetp();
! Y! Z, O. k: N/ |) S  L+ W                actionGroup = new ActionGroupImpl(aZone);. R5 V0 r. @9 }' a9 D  ]
                schedule = new ScheduleImpl(aZone);, X: [% y6 [( p( F& t% X$ y' q: ?
                try {
; t' W+ {5 H1 x- N, P4 @+ ?  d+ _                        Selector agentSel = new Selector(Agent.class, "agentStep", false);
3 n* n6 F2 W; E1 d7 l! ^+ u                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行
% j2 H& ~& Z4 j- E' x8 e% \. Z. }                        , g0 `1 M* k9 ?" ^. U; d, ~
                        actionGroup.createActionForEach$message(list, agentSel);
3 S1 S* A* m; v: D6 Z7 F9 F6 M( X) \                        actionGroup.createActionTo$message(this, swarmSel);& t' z  O3 @/ h) K, {
                        schedule.at$createAction(0, actionGroup);
$ d9 T: }" w% J  a                        schedule.at$createAction(1, actionGroup);
! S- n9 r. r0 S0 z4 k+ K3 h                        schedule.at$createAction(2, actionGroup);
, V6 E9 S, a/ O% A, k7 @3 ^
- W  A# L2 T' |                } catch (Exception e) {
. O& e8 B/ e4 X6 T/ B, H4 b                        e.printStackTrace(System.err);
2 x) i0 k. }* A: J( @9 H) H                        //System.out.println(e);; O- v8 n8 n2 }
                        System.exit(1);
/ v% Z% u, p2 u# U5 m* Z                }
  s9 m. V7 N: c3 }% ^5 o, I5 |+ g' }" J# P2 x# i

; T4 A8 y- W# \4 }2 o3 W        }
, o9 A2 K% Z; x1 Z( I, I* g5 R$ M; e- A2 s& |" g: p* X: J
        private void swarmSetp() {
! m! k; R$ B& K. B; N. ]( [                list.addLast(new Agent(Id));3 ~" y: U& M. u  m8 |/ G3 P6 }
                Id++;
4 V, T9 c2 t6 e        }6 z# w( w& C8 V; f

0 _$ X6 u# g/ t$ s  Z6 a. W0 a        public Activity activateIn(Swarm context) {
. a& _, ~' _/ J                super.activateIn(context);+ H1 M$ _/ Y% E& G6 Y' V. |- \
                schedule.activateIn(this);
0 X: _: h; D- U4 y                return getActivity();
5 U; ?7 Y+ }2 |1 k0 d' j, y        }
2 z1 N, M8 u! Z% |; Z& V0 r8 l; k9 }3 ]0 e7 a# ?1 b, y3 Q
        public static void main(String[] args) {, h7 y& g/ @5 N- Q' n* M
                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);) f' R3 E% L" ^4 N5 K+ U9 y8 G
                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);
. U' n* [2 j4 m4 l( ~& l9 y1 n1 G                swarms.buildObjects();, G2 m0 B5 O( F, F
                swarms.buildActions();
2 }6 {1 H" \. \; C% H4 n5 S9 ?0 @7 k: y                swarms.activateIn(null).run();
" ?5 Q" @4 D+ R/ T  v% d5 w        }3 i; `8 t% U& n7 {. c0 C
: _; r- G2 t8 J, N
}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-12-8 01:23 , Processed in 0.014056 second(s), 15 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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