设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 7933|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑
- I- _5 k# q  H: [- r4 I( |! L* A9 g  c) \/ x
本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21
5 N5 Q% o7 x% @" V: I  p" ?以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.' P9 j) r  e% i/ J+ Y3 y. s# M! ?
swarm.SignatureNotFoundException8 x2 `; @: q3 ~; @, I- E- M" T& k
        at swarm.Selector.<init>(Selector.java:76)& i. \7 x3 r* K1 }
        at ActionGroupDemo.<init>(ActionGroupDemo.java:37), O7 Y" J7 P# g1 B: W. G
        at ActionGroupDemo.main(ActionGroupDemo.java:67)
8 x, `1 V& j; M  F9 o' ~$ E: `8 }; D# Y  x7 s
6 x8 Q/ ~* `  g. l* \! b. R
import swarm.objectbase.SwarmImpl;0 M7 E6 F  o3 V; A! W& e
import swarm.objectbase.Swarm;( s$ R8 @; o) I' U# d5 c  b* x
import swarm.activity.ScheduleImpl;+ o7 R; \0 l4 b  l# i
import swarm.activity.Activity;" P& i; Z/ z- g) |
import swarm.activity.ActionGroupImpl;
6 D% _+ @- C+ w$ n) y' Y0 P8 himport swarm.collections.ListImpl;; r1 N1 ~, x6 g  q+ A7 z! `
import swarm.defobj.Zone;
3 s. _9 |) w2 Y! ?; y4 @3 ?" s1 himport swarm.Globals;) N- k2 q) G# s; i
import swarm.Selector;
" D. L4 p+ I4 |import swarm.activity.ActionGroup; 2 E: X. z! M! |1 s5 r
class Agent {
# `# o7 ^$ ]& v" H' V% X& ^9 Z        char id;4 O* `3 F# w9 u: c8 r
9 F9 A/ `% d, }: V: o+ V' d
        Agent(char id) {
' e2 X. Z5 q4 w9 j                this.id = id;
6 {3 m1 N& Q9 t+ W. u$ J        }
) I  d; x$ ?6 q% s# D' D' b
$ x2 k9 }/ h# V3 r        public void agentStep() {
# T  I% M! }4 V9 A                System.out.println(id + ":" + Globals.env.getCurrentTime());
2 t# n+ C7 f, C$ a3 l8 ?3 ^7 L        }
3 i; P6 j1 k! b3 v3 b6 K}' y% [: o3 ^7 o% C4 D
6 d2 S3 @* D& O5 c3 p  J
public class ActionGroupDemo extends SwarmImpl {* ]; m3 v" h4 Q! a3 N4 U3 s
        ScheduleImpl schedule;* ?2 D# J% E& i9 o7 O
        ActionGroupImpl actionGroup;" |  \4 V6 u$ b5 O
        ListImpl list;' z" C* s! f! h
        char Id = 'a';
$ H9 E1 h! X4 {, i; }4 x* n0 Z8 B% t1 v1 M: r8 h
        ActionGroupDemo(Zone aZone) {
0 G' p( Q$ f8 }' ~. e2 u% V' u                super(aZone);
5 Z% H8 g! O6 I9 ?/ i# t                list = new ListImpl(aZone);
9 I7 O+ b% G. ~6 Y% h/ j                swarmSetp();
9 x! X! o  n; L' s                actionGroup = new ActionGroupImpl(aZone);. O. d) Q' O; |. d/ h# s
                schedule = new ScheduleImpl(aZone);  z1 e" `. g2 U7 B6 M. y; g
                try {
$ L: u& l3 F( D- M                        Selector agentSel = new Selector(Agent.class, "agentStep", false);
! ?( X7 h5 I. G/ L% l                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行
* u1 z3 F# a8 S' @5 q                        
: z# k. s3 T9 ~' d$ T                        actionGroup.createActionForEach$message(list, agentSel);
& O; p3 y9 F- p/ D1 q* r6 a, q6 t& B                        actionGroup.createActionTo$message(this, swarmSel);
  \9 ~3 a) }( m                        schedule.at$createAction(0, actionGroup);! h, [- a0 K4 K7 m4 W2 Q
                        schedule.at$createAction(1, actionGroup);! Y1 Q6 @. c7 ~0 t6 g
                        schedule.at$createAction(2, actionGroup);. @; x* m9 t0 b3 q* i

$ N- ~3 X3 h/ i5 o3 a, P: J! C                } catch (Exception e) {$ ^+ ]# }  S1 w- c6 {! {. e
                        e.printStackTrace(System.err);
& o3 M/ l5 ^9 b& Q( J; g                        //System.out.println(e);. ?( O4 S4 X% @7 V9 g! b
                        System.exit(1);
- }2 |# Q/ `6 n) g0 }1 M- }                }/ O# A- {, A7 \9 s, x
  J! v2 |, R4 y4 B  _4 J$ R1 x

$ x% D& s! d0 T        }7 m$ z0 B1 R; F$ [* K. Y$ N4 n& K/ H0 w
. T& z* K3 l( ], C
        private void swarmSetp() {
1 j" n* B9 e3 g7 ]2 |! T                list.addLast(new Agent(Id));0 }- o) l0 F: g5 E$ c
                Id++;* L* W( v- A8 |; R
        }" M4 h4 O6 Y! h, ]& b

! Q6 A6 b1 a) T/ v: `        public Activity activateIn(Swarm context) {& S# _6 J0 X9 x2 R# z* G
                super.activateIn(context);7 Q/ c- t" c6 L; T, E5 W, Q9 y) W* R" w
                schedule.activateIn(this);+ d; |0 [& C- B, j( e% H$ `# R
                return getActivity();
/ t5 m& M* J- l0 Y        }
2 s5 i& U; G; m6 n
* Y5 I) n: g  K" |3 n: s        public static void main(String[] args) {
; n4 c4 S, w7 H; J; T) t                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);$ D& A% F! |& T; a. b, m$ n
                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);
" s5 Y; F3 h; v0 d+ A, Y                swarms.buildObjects();$ {+ A. O5 p( N1 m3 F
                swarms.buildActions();: w1 e8 r; Q' j  H% x1 U( Y. u
                swarms.activateIn(null).run();! |) N, ]  ?5 P& y' G
        }
. f- ]& T# y5 {: S* t- W" G( G6 r2 ^5 @4 e% _0 ]/ L
}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-3-22 22:07 , Processed in 0.021986 second(s), 15 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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