设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 8999|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑
; t* L9 Z; K7 W' m
/ n, g- g9 U  {本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21# d2 {- A' b2 N6 E
以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.
( f8 y  t$ a2 p+ B4 T2 f& wswarm.SignatureNotFoundException
( _- K0 ?1 ^4 G, x6 Q/ i        at swarm.Selector.<init>(Selector.java:76)
. K4 W* |& j' p" b- i8 f        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)7 x/ [7 j& O; L* S, S2 U
        at ActionGroupDemo.main(ActionGroupDemo.java:67), i, S# I4 B3 H+ j

/ J& T* k6 T: a; f$ [
, b. q8 t# Q# _9 a) N- y; P2 u# vimport swarm.objectbase.SwarmImpl;
  u& M# t( E: s- E) |9 zimport swarm.objectbase.Swarm;
/ h+ ?! `9 S; ?$ y, Limport swarm.activity.ScheduleImpl;
% c% R6 f9 D' z) ~import swarm.activity.Activity;
4 `( R" N  j% J+ q/ m: Rimport swarm.activity.ActionGroupImpl;/ ?! o/ F, ]0 g* t
import swarm.collections.ListImpl;
1 E7 h/ h2 i% W$ x1 Q1 [( Iimport swarm.defobj.Zone; , n% I" E* D* I
import swarm.Globals;$ P4 u& N" ~; @0 ^( ?
import swarm.Selector;
% B) m' @, b2 x1 S( f; Z* \2 p2 P* Dimport swarm.activity.ActionGroup; 4 X8 i! F: e' t4 i5 Z
class Agent {
/ J4 }2 D6 r6 q3 m  j        char id;
  ]6 |  A* A* f4 E! Q* ?( r: {, W" ]
        Agent(char id) {) p8 C, g( X( _6 U. s
                this.id = id;# g" y) [1 F; y' z' ~$ J
        }& w: u% u: z1 {) f2 Z* N2 q( `- ]
0 g; V/ C" D5 }/ a3 G
        public void agentStep() {
. P/ ?, y9 O3 `1 y/ s, W0 P4 r                System.out.println(id + ":" + Globals.env.getCurrentTime());6 L$ a  i' |7 W5 i' f" W
        }
6 F" H- Q. b8 T5 K7 ^/ [}# j( _0 Z5 b, V8 S" U+ z! B
# H+ I# g, \. E9 T* W7 l
public class ActionGroupDemo extends SwarmImpl {
2 |- {& x) I1 R+ t6 q. Y* E        ScheduleImpl schedule;- @+ G+ [/ c6 R4 p- _
        ActionGroupImpl actionGroup;
- ^. E; [, Y7 a; a0 c        ListImpl list;/ U0 t7 U/ H$ J  E1 {+ v$ g
        char Id = 'a';6 [6 f# c0 ]! ?0 X

7 L1 S  ~. w2 @+ o        ActionGroupDemo(Zone aZone) {' v: Q, Q8 ~. Z4 ^( {
                super(aZone);
  w+ l) S" I8 X$ z1 U                list = new ListImpl(aZone);
* X4 Y" n& z9 h8 ~, l+ |; N                swarmSetp();
" K3 Z4 n0 [# I5 f+ c5 ~                actionGroup = new ActionGroupImpl(aZone);7 R5 B5 W& y' K. R& i8 g
                schedule = new ScheduleImpl(aZone);0 y+ r- \3 P. a4 L6 ?4 b, ]7 R( x
                try {, e% U# I9 D* }
                        Selector agentSel = new Selector(Agent.class, "agentStep", false);% f7 s& Y4 d  i- Y2 Z
                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行
  R( B0 A2 N4 j7 {5 M                        
% N" d, x- @2 H$ A/ y* W                        actionGroup.createActionForEach$message(list, agentSel);
! `3 c  l, x  Q7 a( H  X                        actionGroup.createActionTo$message(this, swarmSel);
2 M6 Z3 t, T+ _8 A5 w9 |1 n5 p                        schedule.at$createAction(0, actionGroup);
. i6 U+ b6 I8 U0 g* s' Z. |5 x; E                        schedule.at$createAction(1, actionGroup);
" u& ~, s8 ~. R: I; M2 [                        schedule.at$createAction(2, actionGroup);7 w+ O, U3 J& y
0 ?( T" k5 _. }6 c
                } catch (Exception e) {
$ h# g' _3 O* X$ d( I4 m8 l3 e' f  J                        e.printStackTrace(System.err);
( O8 Y" X6 o! p) @$ e4 z6 E7 z                        //System.out.println(e);; E7 G" \/ I4 }* a
                        System.exit(1);* c" l0 y9 t% K9 O# U) v7 p
                }  j! {" n6 R5 n9 F

+ `7 f0 F& F/ d, B( w$ G6 m8 F- [* M# V+ c* ^
        }
3 I, w% v# \. `) i/ F1 z8 ?, d7 X5 f4 T+ F, q
        private void swarmSetp() {& O( S( \: }& K4 v  I3 Z
                list.addLast(new Agent(Id));
6 r+ A/ c0 y8 f$ b5 r0 _                Id++;
/ D9 \0 Z  w) i3 L% {        }& M7 M! K% k- b; I* e: M
% q% Z  V8 g; r6 H* A  N7 M
        public Activity activateIn(Swarm context) {. D* d, G7 ]( U
                super.activateIn(context);- [, Y) B3 L* n5 l' f2 w2 L
                schedule.activateIn(this);- {" s, r4 U  X& Y8 M; \2 [: h
                return getActivity();
* k7 A4 h6 \3 y/ A% k; {* Z        }
& [# h. [8 W$ R8 {1 h9 |( O7 K# {: S6 C
        public static void main(String[] args) {
1 {' O! s7 V% g                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);
* X+ N0 p7 K- {: x                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);; ?' w# M* u$ D' u8 R% L! k
                swarms.buildObjects();
/ g: F1 U5 C0 f# [                swarms.buildActions();) o; U# m4 `' Q: s+ m
                swarms.activateIn(null).run();
8 n# u- o1 r9 l' y( b2 I: c* x7 }2 M        }% Z  Y) M0 [7 Z  F9 ]  S- E
6 {& ^; s" x' R: Q
}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-4-28 17:34 , Processed in 0.015208 second(s), 15 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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