设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 7649|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑 8 W/ b* b( r3 }0 h2 A! h2 Y4 w
' `2 g# J/ S- t$ l& H' x+ c+ u: V
本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21
# I+ _3 H* Z7 Z+ q) O5 |* z; f以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.
/ b" B" o- F9 Z4 Y8 D4 v6 ]swarm.SignatureNotFoundException# L; ]: t' }) W4 Y7 ]; e. I9 o
        at swarm.Selector.<init>(Selector.java:76)
( J( D+ Y) Y$ C) P- @. ~: k; m$ j7 Y        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)1 P! C- N: U5 l8 ?) n8 W7 C3 W# w
        at ActionGroupDemo.main(ActionGroupDemo.java:67)  @3 @% }! X' \1 O* ~  f2 c! n3 F
' q7 k& ]& w0 a! F* w- @3 v

5 \, m5 b) C! k5 fimport swarm.objectbase.SwarmImpl;
; w  Q3 i) e  H9 O8 ?( |import swarm.objectbase.Swarm;
5 B9 u+ t! ]$ @4 a$ Z8 o9 jimport swarm.activity.ScheduleImpl;
9 Q$ |, S) l' {0 i+ zimport swarm.activity.Activity;
6 \: Y; C; @1 P- B1 Z1 ?6 h4 ^import swarm.activity.ActionGroupImpl;& g. V/ \% l# S# o' q0 N% y
import swarm.collections.ListImpl;. W1 d. f6 S  s( d/ B
import swarm.defobj.Zone; 7 [! _0 ^: N/ t- g. D4 f
import swarm.Globals;2 j. O& B+ d  n+ m$ \5 G* K
import swarm.Selector;
# j5 N$ b/ g9 @' Iimport swarm.activity.ActionGroup; ! x  m# ?2 q" z7 @0 A1 @
class Agent {
! e! A+ p% V. V8 r- e0 l        char id;& X+ q2 t; i& ~/ i" C: J$ c- h
7 H' ]6 e/ ~7 K$ _* L6 n* u
        Agent(char id) {
# k5 o) G9 {6 r                this.id = id;' o" m4 N( S+ m- _- w6 q) ^
        }# Z$ @7 i4 _, r/ b% ~

( `5 P5 x2 b2 T5 X5 p1 D2 T+ x        public void agentStep() {
" a7 c$ \8 E2 d5 T9 m- x3 M5 v! I                System.out.println(id + ":" + Globals.env.getCurrentTime());4 ?5 h5 q; _1 J2 O
        }
% U# P0 X8 q7 K8 Z8 l) T0 T2 D  l}
% D( M; x- X* m, R6 G6 b, [; \7 ?! }
public class ActionGroupDemo extends SwarmImpl {" V' j6 X, [5 F0 J8 a: _5 P
        ScheduleImpl schedule;
. L5 o3 k2 F4 r  h# s) k( r0 S        ActionGroupImpl actionGroup;
. n( {' Q3 e/ O        ListImpl list;
3 R7 n5 h) D" I1 b6 W        char Id = 'a';
; [( ]; p: o2 I
  [/ @8 G! I: o: @- t        ActionGroupDemo(Zone aZone) {
5 _, J! t, G5 I' T7 Q* C                super(aZone);
4 Z" r& p8 s. J1 O  m4 E; a. `, }: N' ?                list = new ListImpl(aZone);
1 R( o$ {& _/ d                swarmSetp();
4 a" E/ A0 f  ~! Y                actionGroup = new ActionGroupImpl(aZone);' c0 @3 v7 Y6 b5 y1 E+ z
                schedule = new ScheduleImpl(aZone);
( B' S: g1 Q$ T. F) z: |( m* ]2 x                try {
) m. G7 J* b, w2 h( H+ T                        Selector agentSel = new Selector(Agent.class, "agentStep", false);
! R8 J# k, e/ j8 r: s5 ]7 T                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行
4 w) O# F  p* Q9 I                        8 j/ n* m* ?: Y' a! t( P
                        actionGroup.createActionForEach$message(list, agentSel);; _0 x- {5 M8 b7 z
                        actionGroup.createActionTo$message(this, swarmSel);
1 u& H4 ^/ J; y. K+ y; A                        schedule.at$createAction(0, actionGroup);  s; b- I& g* Z( S  R2 ?& n
                        schedule.at$createAction(1, actionGroup);
) M# o% s2 ~2 I5 {! w                        schedule.at$createAction(2, actionGroup);
, ?2 x4 K% ?+ `( h9 v2 ]* w. h/ x+ {& D0 a' A
                } catch (Exception e) {3 y, {( g0 D& G) W: v6 Q8 l! m
                        e.printStackTrace(System.err);3 h9 J8 v4 o8 E& z. o( E
                        //System.out.println(e);
- I3 S5 e, z( j- L" z. X                        System.exit(1);) B4 z# W; Z' _
                }8 {2 Y# n9 F3 {& l

; s# U2 h" u6 r
% s/ Q# C" H8 I$ ?) t) o; }        }
0 I, q! k) Z1 Q6 O# j4 C- C
3 c/ B: y) H! n        private void swarmSetp() {
8 B5 p: l; i5 P6 ]' X                list.addLast(new Agent(Id));8 C- A- B( G- H
                Id++;1 d# c' b9 x  M8 g
        }
! ^  M9 X$ U7 Q3 N7 F1 X, E4 I7 q$ H: d
        public Activity activateIn(Swarm context) {4 h1 F) C% n# z+ a/ y5 N7 Q! v
                super.activateIn(context);
3 |/ a2 M+ t. ?1 w7 C                schedule.activateIn(this);0 Q3 {. d" Q, V, f# L5 \2 ?
                return getActivity();& t+ N. A5 w0 a) k% J
        }
! m" I7 \8 T* V8 I
& P) T6 q  u% F7 ?  w: P        public static void main(String[] args) {
6 S/ l8 t' ]( l* D6 A, @) p                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);2 z- z; K& t1 d
                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);' W0 c3 L6 F6 A$ K  t
                swarms.buildObjects();
% r0 A  S& o" e3 ?                swarms.buildActions();9 i$ _, ?  l  m9 R
                swarms.activateIn(null).run();
9 k! j( j2 q* z8 X        }
: V, V8 c; G9 p/ k+ E3 a2 ~. Z* W& t5 R& x
}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-3-10 07:00 , Processed in 0.016299 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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