设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 6468|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑
8 B7 Z2 [2 ]5 G8 a: b! s' M
* D* b- x/ p; X/ s: \& ^本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21
' X; a2 d! J+ N; ^以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.
0 s7 Z% x2 [% y  P0 y& F5 wswarm.SignatureNotFoundException
8 _) A4 K9 b. Z( G6 _! K  W4 t        at swarm.Selector.<init>(Selector.java:76)
5 C/ y* D  f9 B' F        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)2 v1 N) q/ J1 r0 X0 \% l
        at ActionGroupDemo.main(ActionGroupDemo.java:67)* z, }2 C8 O: W
- f: L* m/ I; Z+ ]6 l# q
- ?5 f8 {$ D, f# v
import swarm.objectbase.SwarmImpl;
6 L  r! ?( H3 {% a& @% b8 e$ nimport swarm.objectbase.Swarm;5 N7 t3 Z. p) z& x, v) H
import swarm.activity.ScheduleImpl;
" t" j: G1 M  C1 T# dimport swarm.activity.Activity;5 L+ _- y6 J  d2 E
import swarm.activity.ActionGroupImpl;. v4 C" @5 L; u( G/ X7 @
import swarm.collections.ListImpl;7 A" Y/ ^2 Y3 B3 f& U7 x
import swarm.defobj.Zone; + K& f9 i+ K/ u
import swarm.Globals;
% p- t: r; f- jimport swarm.Selector;, U7 Q2 o3 {6 A9 {4 m
import swarm.activity.ActionGroup;
  t- ?9 y$ m- ]. _6 g6 D9 Sclass Agent {2 H. q7 f' p2 _+ H4 c
        char id;; M1 Y& S. X: z- D2 v" A
* G. i8 _: r5 P
        Agent(char id) {+ J  L/ z8 X* u6 H* z' @: u
                this.id = id;/ @: J, |  V  L  y& h* F
        }
/ E" y  B5 f9 {% K/ Y
; J$ o9 U2 n' X/ b- C        public void agentStep() {+ _& y, y$ j- I" Y1 @. E! ?
                System.out.println(id + ":" + Globals.env.getCurrentTime());! ?8 v5 S# u: a& y4 ~
        }
- h2 B4 s$ w8 u) z}9 d/ P4 Z" Q/ R$ H$ {
. c/ f6 Z& C; Q  X
public class ActionGroupDemo extends SwarmImpl {
( g( t' V: H+ Y        ScheduleImpl schedule;
- U& J: r* C4 ?% p        ActionGroupImpl actionGroup;
  |( C8 Z* y5 l/ M2 M        ListImpl list;
. X; P# ?+ e3 N+ u5 M& G( \        char Id = 'a';: r$ @( w! [1 h- Z( o4 T
2 n3 A& n# N( n, c. ]& y4 M$ E0 X
        ActionGroupDemo(Zone aZone) {
: D5 ~$ p1 C: _' U9 c5 o$ ?                super(aZone);
" c/ ]% Y! {6 ^* |2 V                list = new ListImpl(aZone);
1 v( S' }% ^7 R, }) c# i, ^4 }$ x1 h                swarmSetp();
. R; t) V+ v# ^: Y. u6 E% \                actionGroup = new ActionGroupImpl(aZone);: f) C) P7 e5 L" s3 [
                schedule = new ScheduleImpl(aZone);; q6 s6 |4 W: d0 U! o
                try {
. y- ]) |" W- Z. i; v7 x5 @6 i% `                        Selector agentSel = new Selector(Agent.class, "agentStep", false);
/ T. L8 n0 p9 l, c4 w$ p4 L7 I                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行$ N3 h% _' C1 \, ]3 `: D6 @  G: M
                        
! y) K3 [, u& S/ u# o3 E0 B! F5 w                        actionGroup.createActionForEach$message(list, agentSel);
  h9 U) [3 R# ~) y% z; F                        actionGroup.createActionTo$message(this, swarmSel);, f, F; t3 c* X4 w
                        schedule.at$createAction(0, actionGroup);: @( c) s- @( n3 F0 @
                        schedule.at$createAction(1, actionGroup);& @- @! k! ~! L% g: @4 `
                        schedule.at$createAction(2, actionGroup);) ~) R) \+ S4 f, O( ~* Y! H4 h7 u

& G4 I9 U" _, Q; [: d5 x& j5 L9 y                } catch (Exception e) {
1 m! H( ^% E' j7 s$ i) n                        e.printStackTrace(System.err);/ i- K; P& A; J% a
                        //System.out.println(e);6 B' n4 y; I* `; `( l
                        System.exit(1);9 C" b8 o2 X6 c2 S
                }, t' C: v! S+ R
5 h: h% V2 _& P0 v5 J8 t
6 J1 ~' s" J' w; T# n; u* c2 W  ~
        }
% e, l, D9 Y1 m2 ^9 x* Q
2 d& n- \' `8 U& o2 I  r% F        private void swarmSetp() {& l! R; [2 `1 B2 E- E; B
                list.addLast(new Agent(Id));, R) g8 a3 U7 |% ]5 e, \1 I$ L
                Id++;- L( p/ H- u0 O. y/ \2 i
        }
! A# Z* ?7 A* ^9 C) g
# l& n# i) F) V. Y! X/ J        public Activity activateIn(Swarm context) {
; V9 j! D6 |1 h$ {- V  W  N/ V                super.activateIn(context);
1 @* @7 T4 K+ Q" R, B6 X' [                schedule.activateIn(this);; T9 p/ T' I2 a( V% |$ G& a
                return getActivity();
' q; ~2 R. V8 ]* m7 }. P" H        }/ l6 }% f7 R3 P3 ]8 F1 [
: V' ]' H6 b5 z
        public static void main(String[] args) {
( G& D8 X# d2 G( R+ F8 ^0 k                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);8 Y9 x2 I4 V( C( u7 [
                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);- W- X' f& G# s
                swarms.buildObjects();
: K$ I- w% K( D- h5 H                swarms.buildActions();
0 @9 a: }1 J# S( i. G8 L                swarms.activateIn(null).run();% Z) C, e: i  F" y
        }
4 O) l. Z$ ~2 ?/ g/ N( S7 l7 \  G* ]4 Z) ]" x' Y. h
}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-1-29 12:14 , Processed in 0.015627 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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