设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 6289|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑
4 Q, W% Y8 A( M" N* o
" M, [! o- u* T0 n本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21; P, Y  a% }* A& P5 g+ W
以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.4 L- B# P6 O; B5 o- l% E
swarm.SignatureNotFoundException1 c: U) m/ x% r9 u, h
        at swarm.Selector.<init>(Selector.java:76)
5 R2 P4 _) T  T1 }) P! W        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)
" F1 }- S* c  a4 \3 N        at ActionGroupDemo.main(ActionGroupDemo.java:67)
9 k! @* n. i5 \! O
- X0 ^* K/ j1 ^0 ?8 _5 h
) x8 y0 {: z# Z" G. Q- a8 h/ d% W% C% mimport swarm.objectbase.SwarmImpl;. T# t8 B8 ^% w* W9 Z6 t0 v
import swarm.objectbase.Swarm;
9 B5 Y6 U0 Z% E4 g" }6 gimport swarm.activity.ScheduleImpl;+ J4 U) ^6 @9 \3 F& x
import swarm.activity.Activity;
6 n* |) [4 J9 L3 I8 S( \import swarm.activity.ActionGroupImpl;
5 [8 H8 s* t! C! x( Wimport swarm.collections.ListImpl;- `8 X" h  C; ^  e' ]4 v# B) O
import swarm.defobj.Zone;
/ ?$ k! N0 G% ?: a) u, N+ L8 U4 L  Rimport swarm.Globals;- e! f4 ^7 C1 R* [  S- u& O  y
import swarm.Selector;1 @( r- X2 t! S
import swarm.activity.ActionGroup; , o: J6 K/ ]  e; k% r( N9 i0 W
class Agent {
: R- k7 K: _3 O0 k# U7 m- p( a        char id;2 b4 k8 B6 z& E( \

+ t- b6 Q/ j) \3 h8 a, C; N        Agent(char id) {; S5 t. s* X- W; c
                this.id = id;1 Y" u+ a4 I, h
        }& h& }' {4 h% B5 m# \6 _
9 ?2 Y) }" W8 \! @0 T1 H+ {
        public void agentStep() {5 q6 [- T2 E+ B/ r: }1 g* u# N
                System.out.println(id + ":" + Globals.env.getCurrentTime());/ R  |' \8 @# p9 r4 n% ^$ X) Q
        }6 P) h4 g/ @$ y  m
}' i" u# v7 O& s& X

6 u1 y+ s1 ]6 s, M, g2 Q$ \public class ActionGroupDemo extends SwarmImpl {
- i  a6 z: O' Q& n, i& _        ScheduleImpl schedule;& N% G+ j+ N6 K  q  ^1 ^
        ActionGroupImpl actionGroup;
9 a! i+ m; n/ U& k        ListImpl list;" V% e; Z$ s/ s" E5 X* e
        char Id = 'a';
4 w: f" j3 @0 R0 A9 t. `# J$ S; H  Z$ I3 V& d( s2 F( `. F
        ActionGroupDemo(Zone aZone) {' ^! o3 w2 G3 u  ^5 y7 l
                super(aZone);
. S/ r$ [, ?' t5 C3 L3 H                list = new ListImpl(aZone);
  O5 y  j7 Z% j) G! h                swarmSetp();
0 l! v: K7 ~5 `                actionGroup = new ActionGroupImpl(aZone);4 W6 X0 W) `1 j$ V# Y  o1 w5 q6 y
                schedule = new ScheduleImpl(aZone);, z# b4 e- r1 Y7 b
                try {9 J: V4 `6 d/ }0 R' a
                        Selector agentSel = new Selector(Agent.class, "agentStep", false);
7 d" L+ @: K: r. I& t. \4 m                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行4 b/ P& F* Q1 ?  F
                        
$ e3 U: p2 l& [  K  Y                        actionGroup.createActionForEach$message(list, agentSel);
1 o: X3 i% d) f/ K  N) _                        actionGroup.createActionTo$message(this, swarmSel);0 l+ r+ L* p) U  ]* m) H; h$ r
                        schedule.at$createAction(0, actionGroup);2 R# _+ |% n% T( Q
                        schedule.at$createAction(1, actionGroup);6 [* w( w4 h6 C5 \# E: q8 N
                        schedule.at$createAction(2, actionGroup);& X5 H, i' `- s. n% c

) i' T+ c& @& [1 M0 p                } catch (Exception e) {
- X: g! z+ _3 q& S                        e.printStackTrace(System.err);
# q0 [$ c6 F+ o3 J2 B0 s4 f                        //System.out.println(e);
- |4 R$ O  `0 }                        System.exit(1);
/ x+ x8 _" i' A7 R4 X6 x. b                }
4 ^8 u# x8 b7 ~- u4 c7 Y' O: z' \
4 A( W6 M, l; ~2 _/ `
% N9 D. K+ M/ A! F        }/ X) Y- P* |7 L% G$ t! h9 ?

3 p2 K' A* U9 f+ v4 |# o        private void swarmSetp() {
# M  q2 w8 ^# F; P                list.addLast(new Agent(Id));
4 U9 B9 `6 S7 X; b7 x! n                Id++;4 s$ W  H2 A" S$ K! C3 ~
        }
% d/ Z2 u) G2 ^. w. u5 @# N
6 j! F4 W" Q4 S; m  d( D/ J        public Activity activateIn(Swarm context) {
# _6 C1 }' c. g& \0 F# ?* ~% \                super.activateIn(context);
% e% W( }9 I, h& l) p                schedule.activateIn(this);
- k. S+ P* N, t7 k" k8 s                return getActivity();( u# Y5 L1 o5 Z2 H
        }, q$ F) P  c( R- |9 H" C
6 E3 G7 z0 y2 S& ~
        public static void main(String[] args) {
5 E1 W, i  E/ {                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);
8 r/ D! j7 V2 F                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);$ f# O0 q3 R4 N* n- x& h  ~% B
                swarms.buildObjects();1 u. a: B! `, W0 s3 r
                swarms.buildActions();
8 ~6 H/ L; l( }) q9 T7 ?% K, b                swarms.activateIn(null).run();
9 ?4 g; i' j! H4 o  S        }
" A) P; E' }# h  F* h' e9 E* b' v. Y  t8 E
}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-1-24 00:04 , Processed in 0.015440 second(s), 15 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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