设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 13772|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑 0 y+ m  e8 B$ X* J- U' g3 V

, E% }3 D; x, m5 r本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21
. T0 y$ g9 V  {: S) A以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.  D9 b' X7 T2 U. L! R
swarm.SignatureNotFoundException  B  z, r3 Y+ Z' ], g* L
        at swarm.Selector.<init>(Selector.java:76)9 K. @2 i" n  I6 Y1 B0 v
        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)
  k3 d, j: [6 V6 g        at ActionGroupDemo.main(ActionGroupDemo.java:67)
6 v  ?& E* S: L: X
$ X2 a% E* r3 g& Z1 `9 o6 I7 \
" X6 D$ R. u$ J2 q+ uimport swarm.objectbase.SwarmImpl;5 n1 r8 N* d, X1 R
import swarm.objectbase.Swarm;8 y! }3 T4 b2 ~  o# w6 r- f2 c
import swarm.activity.ScheduleImpl;
0 }& ~* r3 }# `import swarm.activity.Activity;
0 P1 I- \; ?/ oimport swarm.activity.ActionGroupImpl;
  x# L: z! o6 fimport swarm.collections.ListImpl;
- d0 t; T3 Y1 ?: S; B$ f' G5 [  kimport swarm.defobj.Zone;
3 X6 j5 q, w: Dimport swarm.Globals;% d! v6 }# W2 Q3 K; S; v: G
import swarm.Selector;( E* W' H: X; A) u
import swarm.activity.ActionGroup;
% {- w; Q; U4 t/ ?4 J' wclass Agent {
0 w6 n* h5 n) {9 ~9 V6 j        char id;2 K& ]0 w' p4 y% G1 v+ p
8 Y1 \" X6 Z' |; j! _9 [% o  p
        Agent(char id) {) g7 J+ g3 r& y/ }
                this.id = id;
; F4 u% \8 e5 s. r  I; D& ?        }  ^8 \& c- j  o8 r8 s
+ B  a: X8 [% B# c- G# O: `" O" k
        public void agentStep() {
# z1 Q! A' o! @, j7 H  \$ w* Q" q0 x                System.out.println(id + ":" + Globals.env.getCurrentTime());' G7 x# p3 _# ]4 t
        }
5 [2 f$ O/ d. A2 ]}
: ^* n; d4 l, y8 O4 u, ~
  Q. ]! G# _  f6 B1 E9 ipublic class ActionGroupDemo extends SwarmImpl {
9 Q9 Q  k5 F7 l. _+ {3 {5 U0 h        ScheduleImpl schedule;
1 T. f6 I+ e. Y- e( W4 Z        ActionGroupImpl actionGroup;
% B( x# u  I5 k& M* o9 `5 e( h1 D0 f        ListImpl list;
6 H% N! P) m5 W; @: ]& X        char Id = 'a';2 @& N6 ]4 f; V. d% i
" D: h0 O; h. t- }5 _9 A  A& Z
        ActionGroupDemo(Zone aZone) {8 v2 v2 |7 P; ^' ?
                super(aZone);
$ J- q. g* W8 m5 m; F! z) V9 Z                list = new ListImpl(aZone);6 G# i7 j6 V. L4 M/ @( @
                swarmSetp();- T& S4 W8 o1 g) S
                actionGroup = new ActionGroupImpl(aZone);
2 Z, h& b" J2 z, \, ^                schedule = new ScheduleImpl(aZone);
) J2 I3 K1 E3 V4 Q" i                try {) o& C- s4 C' d4 F/ G" \# j
                        Selector agentSel = new Selector(Agent.class, "agentStep", false);' _6 T8 D( ?3 h  T
                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行
' a* A, R  G8 \                        9 L. {- F8 t+ w. b8 d" O
                        actionGroup.createActionForEach$message(list, agentSel);
# A* e- T; F- E6 R* X& @                        actionGroup.createActionTo$message(this, swarmSel);
' E: b- v/ D' O0 `4 I8 F  \- f! n                        schedule.at$createAction(0, actionGroup);
7 K2 C: m/ W. j# k! a                        schedule.at$createAction(1, actionGroup);; M! T3 e) F& G% ~8 w! b
                        schedule.at$createAction(2, actionGroup);# Q9 ^( B! z. x  P& g: T+ z6 W
) I& v1 E+ s# o
                } catch (Exception e) {( m- ?4 J3 A2 f% t3 ~; a% h' x
                        e.printStackTrace(System.err);
* X! ~; g" `. r- G8 C! |* t                        //System.out.println(e);
4 @/ q6 g9 q6 |* H; V: v* w                        System.exit(1);$ F; V" L6 ?  t" [) ^2 v
                }
# p- {4 N6 x- c7 u. g" O+ b+ J& B+ f5 w* x
5 l4 @( S1 o' X8 W4 G8 ?2 g
        }
6 J  D) E) B" b, A+ Q' E% \8 _. Z- Y- \1 X
        private void swarmSetp() {
& t/ R8 z. I; z) V: }                list.addLast(new Agent(Id));
0 @/ p) X4 ~) A9 n$ `7 V                Id++;& O  ?$ K1 c; e- G8 r: x) U7 L) @
        }
9 r5 h$ s- L" V. J1 |: K( J+ u& ?
        public Activity activateIn(Swarm context) {
8 t, n* Y$ q# N+ U                super.activateIn(context);
1 ^1 ]% C# D$ }3 V" `: O2 s                schedule.activateIn(this);8 n9 C1 H/ X# [
                return getActivity();( |" \, u  q, s5 j4 j5 y7 R1 F' @
        }2 F+ n+ o1 I' B

& G- p% Y# m3 B. P0 f$ [        public static void main(String[] args) {$ \1 r, z2 {0 O* K. o
                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);- ~- V* [  X/ l" O- H5 T9 n
                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);
5 W- {# `" w* K5 `8 @                swarms.buildObjects();
& I0 F6 e9 U  {; @9 W) r                swarms.buildActions();
3 V3 F( Y6 ?  b! Z1 D( b                swarms.activateIn(null).run();
$ E4 X6 D+ s( `! t        }
, L( c0 y5 Y% f$ h0 _5 K+ @3 D" r( p( e& V' c  c# d' n
}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-9-17 02:33 , Processed in 0.016817 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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