设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 6185|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑 , _+ L4 z+ v% p

( I: ~! U- Y1 d9 N本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21
9 r; u- `* k- |8 T6 h以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.
" ?7 t$ n5 ^# s' l0 @2 @swarm.SignatureNotFoundException
# i: T# b  s4 e0 O2 @        at swarm.Selector.<init>(Selector.java:76). i) Y% h$ q( R/ U
        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)$ x; G3 \* m- M( j  i
        at ActionGroupDemo.main(ActionGroupDemo.java:67)
( b" b& I; v# C6 t
, C, T; T+ c  P; d/ j$ y) ?
# h5 m: h) i! C& Iimport swarm.objectbase.SwarmImpl;
9 \+ \+ V0 [) w& Z1 y) \import swarm.objectbase.Swarm;
/ ]& \& @% S# V9 o) }  J1 fimport swarm.activity.ScheduleImpl;
9 P$ Z. J- f: R, g0 H% Gimport swarm.activity.Activity;
$ y& w! o  A& Y3 {import swarm.activity.ActionGroupImpl;8 ~6 e$ z/ r" Q( M7 R' s
import swarm.collections.ListImpl;* X9 C8 d& V+ g7 e5 S1 T
import swarm.defobj.Zone;
" W, w. d. V# I( Y- [  Uimport swarm.Globals;
; S: E0 H& O0 |' M5 `& Bimport swarm.Selector;
& Z5 g( |2 z3 d2 w3 nimport swarm.activity.ActionGroup; $ s  s9 c2 M! V5 E7 p
class Agent {
% l& A3 T$ g" N/ w        char id;0 g. S* f, \. m# T

0 n" K  ?5 G0 o7 Z6 z4 h$ j        Agent(char id) {
: i& c9 Y* C2 |2 }                this.id = id;, J  Z& _" s8 S6 S7 j
        }( j- R, ]; p* d# F2 k) Y" a

' Q4 a3 T, A& [+ P  M9 }        public void agentStep() {
6 x$ I0 \% ]7 G( N$ I5 v                System.out.println(id + ":" + Globals.env.getCurrentTime());
. K+ S5 A* G- E! h. O        }' k4 m7 O# S0 a8 b
}
' f' D; x- _9 ]" Y. ?7 @! c
. g, s( U) _* c9 l8 Zpublic class ActionGroupDemo extends SwarmImpl {% ~& r& E1 x. F+ E9 P; t
        ScheduleImpl schedule;* |. Y3 a7 D4 C
        ActionGroupImpl actionGroup;
6 v2 U8 o) l1 h" V8 ]' v9 r) D        ListImpl list;
7 I- x$ q  |1 @/ U        char Id = 'a';! s8 Q2 \# K. Z+ \( _
% \8 K4 v6 M" v1 o1 c& t
        ActionGroupDemo(Zone aZone) {
3 X) o. i+ Z# a) M2 y                super(aZone);
1 I- C* H$ n! l9 J3 g% x1 V                list = new ListImpl(aZone);1 I. t2 f) ]9 X7 A
                swarmSetp();7 \& h; J& M) Q6 w
                actionGroup = new ActionGroupImpl(aZone);
) n! U' P% l3 B2 V! @( e                schedule = new ScheduleImpl(aZone);" w  V) w2 F& a% q3 ?
                try {
0 `% h, [! K- l: r( T! c, P# e                        Selector agentSel = new Selector(Agent.class, "agentStep", false);
6 I6 v& L: T9 f7 e7 j; }  k                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行
6 Q# V8 ^; a: T% d: O$ |                        
  W4 B& r# G6 E- K                        actionGroup.createActionForEach$message(list, agentSel);0 g! R/ C. ^, O, b  ?9 D7 V# H
                        actionGroup.createActionTo$message(this, swarmSel);+ ^* C2 ~7 f+ Y5 a" S
                        schedule.at$createAction(0, actionGroup);
6 G7 B: J: a4 U; I                        schedule.at$createAction(1, actionGroup);  H. X0 p4 p' M. Y: o0 n2 O) i4 \# ^3 `
                        schedule.at$createAction(2, actionGroup);6 `3 ^& B0 \: T0 y! J7 x1 q  f
* y2 q- w% s+ B4 f" U
                } catch (Exception e) {- r/ A/ y/ P# _3 J0 I7 `  w6 G
                        e.printStackTrace(System.err);# Y7 i0 l4 V. n) K3 b
                        //System.out.println(e);
6 s2 C/ b! i; L. A5 d5 l1 `                        System.exit(1);1 V& D+ M! _  h$ g8 n# T
                }
; R3 @; L3 s7 ?9 j0 ^) s5 s/ l' ^# N. @. M7 C

; d- ~2 @7 Y  P+ T3 q( k; i- c; [        }
* H0 [5 s& R" j" t: |4 i: j; L
: [) K+ K8 y% A4 O1 A        private void swarmSetp() {2 d! D- G1 }8 j
                list.addLast(new Agent(Id));3 H' D9 `5 B, |, |  M, H9 d# z
                Id++;
" B6 J) a' [* E) _6 \+ r. V        }& H. u! [; F2 s, Z& ~, l( }3 o# R

" g% e6 o$ _) ~2 M' f# n        public Activity activateIn(Swarm context) {5 u9 V& R/ B/ _: i& i
                super.activateIn(context);
! c# ~7 \' k/ z( a! }/ z                schedule.activateIn(this);
9 P% o+ g3 K8 y/ u4 L                return getActivity();
& Q$ [9 O* j6 D        }
0 g  s% N5 _) b, m  K
' @- h8 S- D- s" D  N. [/ x        public static void main(String[] args) {
3 ]6 V6 s# G& T$ D0 f                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);
* C: t* L( F5 c, h+ p                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);- G$ [/ s7 X. o. Y3 z/ m4 E
                swarms.buildObjects();
) V+ f. ~$ U" y* T/ ^: i% Q                swarms.buildActions();
% H; `1 q+ t: ^" }2 ], u                swarms.activateIn(null).run();
$ w: r8 Q' j: J! E. I        }5 o  b! b  g2 w9 j# s

+ Y" A1 C  z# L1 X2 _% x' R0 O}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-1-20 18:47 , Processed in 0.015863 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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