设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 13233|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑
1 z0 q3 V6 e! Z" z+ j! h0 H1 Y
4 |* q+ b- L6 w- I  x3 F本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21
8 i! }  Q3 r& d& O以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.
4 Q- E( R6 G8 s' \5 a1 uswarm.SignatureNotFoundException
0 ^$ x8 O  K5 F. H) [        at swarm.Selector.<init>(Selector.java:76)2 _6 e- ]/ S+ `" b2 V( f7 |
        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)7 R8 ~8 G) k5 M; g4 `; r+ T  I8 V
        at ActionGroupDemo.main(ActionGroupDemo.java:67): F0 f; N: B  z: g& f

' w$ D3 C1 K# m
, ~1 p6 B& p( o  N# l9 b! mimport swarm.objectbase.SwarmImpl;, g: E7 I% A7 S1 v5 r- x
import swarm.objectbase.Swarm;& X2 u- Z- M4 E8 Q" }! g: R
import swarm.activity.ScheduleImpl;
* Y- f6 h& M$ N0 _' S' C9 Yimport swarm.activity.Activity;- _4 y  F. {$ H* X+ G
import swarm.activity.ActionGroupImpl;
$ E- |% n( m# p& ~) `3 oimport swarm.collections.ListImpl;' L3 Z$ l+ i9 k! K& G3 J% {
import swarm.defobj.Zone;
' h4 g2 Y/ J) Gimport swarm.Globals;
2 H! _6 P3 ^4 m% z9 ]import swarm.Selector;4 e$ @/ F! B. f! I" M
import swarm.activity.ActionGroup; ) k' E0 ]% {5 K* @& K1 p
class Agent {
, R& Z) M! P! `* Z9 [, j9 B        char id;7 G$ Y0 o, h4 U/ f+ Z
! U2 x( }0 T, ?- l4 f
        Agent(char id) {' G1 L0 y! c% O5 S$ P  z  \# o
                this.id = id;# r) ]; D: P& b+ x. L* |; }; m
        }
& k* w8 v  @! R# G2 a* A
3 w% a3 `# h9 Q: U5 @! c. l6 s5 W        public void agentStep() {
- P0 r; q1 G! T9 [                System.out.println(id + ":" + Globals.env.getCurrentTime());
! U. w' z+ p% Z9 I" B        }/ X; @( l$ o) ~$ \
}* {, u" ], U" t
$ w; ~; y( }+ h7 k! K5 m# H
public class ActionGroupDemo extends SwarmImpl {, j! f$ a2 e4 ~) K
        ScheduleImpl schedule;6 ]4 }; m2 y$ F! J
        ActionGroupImpl actionGroup;
" c4 U! n3 r# I4 ~/ l+ s3 g, K- r        ListImpl list;1 n& J( Z3 x1 f, R
        char Id = 'a';2 ^8 J" g' B3 Y0 y
# e  F  k7 B* W. T
        ActionGroupDemo(Zone aZone) {
# }& n9 O. c. Q. N5 v' Q/ b                super(aZone);
- E1 I0 B4 a- l% @/ T: a                list = new ListImpl(aZone);. ~9 |. c1 k7 U' q9 U7 [* q/ L
                swarmSetp();- l: n. s8 T8 y2 d7 K) E0 I* j
                actionGroup = new ActionGroupImpl(aZone);' }3 V1 V! m. l
                schedule = new ScheduleImpl(aZone);
' V  `2 p$ p' ^! b                try {( A. l0 d2 l0 u* N- z- D# V
                        Selector agentSel = new Selector(Agent.class, "agentStep", false);9 u3 W4 ?4 [5 o$ e7 f- {
                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行
5 i! b  w! j2 J# M4 E                        0 l" r9 a; k5 L8 l! |! z
                        actionGroup.createActionForEach$message(list, agentSel);  B* z6 h! d% s( r3 x: B
                        actionGroup.createActionTo$message(this, swarmSel);
8 H- W. x' M4 L) r, n2 u4 Y                        schedule.at$createAction(0, actionGroup);2 Q* C5 N* S4 F* F8 T+ [: h  h
                        schedule.at$createAction(1, actionGroup);: P/ B" E  r& R$ }7 ~, q
                        schedule.at$createAction(2, actionGroup);  O( ?) Q; S, C6 @" Y' d
8 P* u1 F; x; V  S
                } catch (Exception e) {
7 K+ |! f1 B! b8 Q& a2 w                        e.printStackTrace(System.err);
  I3 \7 u7 |' V+ U1 X                        //System.out.println(e);
8 t' S6 ?( N/ V' T                        System.exit(1);
* f6 f4 y2 Q5 f# d1 N  C                }
1 y5 W2 m; [. p. {' ]" x, c0 }( d/ q: f/ d2 k% ^
' M$ a1 z' ^: G7 J: a
        }0 K! q2 P- W& e
4 U- V5 M5 c$ g  m( ?0 ^
        private void swarmSetp() {
( l) G# x9 l% J: p) @/ L                list.addLast(new Agent(Id));
4 q- E+ |: F2 \8 k. E$ z: b                Id++;( `5 \$ r. M" ]+ w' n
        }2 b0 E# w# W; b0 i2 D: o

8 n2 F' \& g, q% T; Z5 ]4 y; f        public Activity activateIn(Swarm context) {
3 ~7 O; |4 Z# _+ h) A                super.activateIn(context);0 ^+ `1 H" V7 F# t* x% k
                schedule.activateIn(this);( I3 f+ {, R: d2 B7 |" q
                return getActivity();
' b$ P3 s2 L" ~6 C# k% n        }* p1 T5 Y' U4 D2 B
9 U+ y/ Q  o8 f# I/ W% \" X# a$ ], T! r
        public static void main(String[] args) {
. Y# i0 ~: n6 C8 h. O! @! t                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);
" S$ Z* \1 j$ @1 H7 Y4 B4 Q4 r                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);0 k8 D" n# z* H: V
                swarms.buildObjects();
) m6 A* L+ k: N7 O/ V) }$ e0 a                swarms.buildActions();
9 T: w1 X; c& d                swarms.activateIn(null).run();7 g" C: Q" Q7 L  l+ q
        }4 S! u8 t6 o. _6 U% ?- e+ }
& I9 {/ J* B$ E
}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-9-1 08:41 , Processed in 0.016883 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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