设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 12960|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑 + P- t3 D/ V7 A7 H8 D5 Q% H& J

3 i/ v$ c* }! M1 r$ ^: I) U0 `. u本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21% {/ d/ K' F; e& b# D( W4 ]
以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.) X- {( }% `) j! m* }% ?% k$ J
swarm.SignatureNotFoundException2 M1 X5 ~0 W, s- ^
        at swarm.Selector.<init>(Selector.java:76)
) O9 \& X) O" ]* x) b$ r! ^) H        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)
- y/ l( H3 U) i$ K7 K        at ActionGroupDemo.main(ActionGroupDemo.java:67)3 G) g8 A/ o+ j4 c- F

" _5 N5 a. p/ S$ o7 Y# e* s) C# [2 e2 a3 {0 U1 ^
import swarm.objectbase.SwarmImpl;6 ?* w3 O% f- [4 a) J3 a
import swarm.objectbase.Swarm;
* X+ e, D  n) f  V3 Himport swarm.activity.ScheduleImpl;
: S) u1 ]5 O7 E$ Z  @: _import swarm.activity.Activity;
7 I6 V8 g  H! C( B( M, x. eimport swarm.activity.ActionGroupImpl;
  H) ^5 `6 |. O5 Bimport swarm.collections.ListImpl;
% M$ [! r7 Z; u+ J+ Y7 ^& Ximport swarm.defobj.Zone; 7 j1 n, ?% x  ~4 {' v
import swarm.Globals;
' N; Y1 {" J: Kimport swarm.Selector;3 E9 Q$ Y1 G3 s& s
import swarm.activity.ActionGroup;
) ?5 o; B! @  m  V$ T! n( _class Agent {6 ]& }5 H5 A+ u3 E7 |. m, G
        char id;8 l7 a' ~4 l1 q( \
* {  ~# W' G5 d  H& A
        Agent(char id) {6 j: G) g  l  \
                this.id = id;( T" P7 q2 B  j- F- c7 B
        }
7 ?7 ?4 x, _/ o' i) A4 R8 k) h7 Z
3 |+ p! {3 j# t# b) B9 X        public void agentStep() {
5 T; B6 C$ e* C. {/ b9 P% C: Q                System.out.println(id + ":" + Globals.env.getCurrentTime());
* N/ B# Q$ L& q7 f' m+ v' Z        }: t0 S9 C* O6 F1 _4 q2 O) O* ^% ]
}
$ }3 [# o7 W. [6 F- R
9 f# q) s; K9 A1 \! Z2 r7 [) C% _public class ActionGroupDemo extends SwarmImpl {
' v/ a# J! |! ]8 E& A2 I( {4 g0 }        ScheduleImpl schedule;( N8 J+ ?; W3 R6 }$ g5 b" W
        ActionGroupImpl actionGroup;2 c- m  S% |4 K: m9 ?# @" ~" Z9 O1 r- T' G
        ListImpl list;
% I( c$ s* q( h) _        char Id = 'a';: _7 C% ^3 P' c0 T/ o
) u+ _6 j) s$ l. W
        ActionGroupDemo(Zone aZone) {9 x' _+ q" \( R3 K* r8 K4 Q
                super(aZone);8 p) R3 Y* W* z( \
                list = new ListImpl(aZone);/ N, l$ W3 c' R, t
                swarmSetp();
! c4 o! z- l0 i# s                actionGroup = new ActionGroupImpl(aZone);
: {, ^$ p3 x$ R9 {                schedule = new ScheduleImpl(aZone);
6 |1 ]& o; g5 v- V) J                try {# N! j1 m* \* j6 L, w8 i. r* j7 y
                        Selector agentSel = new Selector(Agent.class, "agentStep", false);
' L. Y8 O% V; y: H" [                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行! o# x$ n; z3 U
                        
2 T" L9 g% A/ n                        actionGroup.createActionForEach$message(list, agentSel);
6 t* A! W/ @4 _. W0 e" f* y, j% q/ o                        actionGroup.createActionTo$message(this, swarmSel);
4 D5 k. P$ _! `                        schedule.at$createAction(0, actionGroup);. y* r5 n: q3 m* \/ d+ [* d9 z
                        schedule.at$createAction(1, actionGroup);
4 I2 H# R: ?- U% Y1 a+ f                        schedule.at$createAction(2, actionGroup);3 a, K# g" a$ {. E
% J8 Z/ S+ x7 y0 _
                } catch (Exception e) {# ]5 Y3 C+ y7 n4 i: C: J
                        e.printStackTrace(System.err);- w# i( b9 p+ A% c4 q5 B- Q
                        //System.out.println(e);
5 v9 Y) Q0 l- j                        System.exit(1);$ h  K# V% H& W1 r" h/ h
                }' B8 c" Q1 s) z& o
6 r: D6 o1 z7 @6 i" ]& z
% p  }4 c' g' j
        }
0 I: _4 {" Q& O/ x+ B# ]2 _; v2 s1 _+ k1 D! c5 i+ l4 A& M
        private void swarmSetp() {
7 i. w' U( d5 a" J                list.addLast(new Agent(Id));; a" f) G  J, A- B' Z- ^8 |
                Id++;; J9 T+ ?0 j8 M+ B% V
        }
9 i! J& W- g% e4 H
( z8 G, J& M+ J. @        public Activity activateIn(Swarm context) {
$ k; |& Q7 h/ @4 r3 M  b                super.activateIn(context);5 b6 A  C7 K' A% x* d
                schedule.activateIn(this);
8 K6 Z, P" S" P  n, |0 c- ]6 Z7 w7 M                return getActivity();
9 [7 A9 t$ z/ x; h        }
* O7 u( z7 c/ B& e. y) q* ~% y7 J& v; V
        public static void main(String[] args) {
& Z, ?+ Z, D" c, Z8 C& |                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);
& N: f: f; c( }# I* [                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);
9 X. i8 J. F# v- J( W                swarms.buildObjects();
' N% y$ @! s0 n3 D3 t- r                swarms.buildActions();3 h6 X4 x$ \/ E: w4 x
                swarms.activateIn(null).run();
8 b" s( {" I1 y        }/ O% n/ q3 [3 H' u+ h

# y$ H' [/ V$ i% |5 I6 h}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-8-24 08:20 , Processed in 0.019508 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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