设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 4858|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑 ; D' T, U! a- q/ @5 I

6 b) |4 w/ \) }+ E: B本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update214 Q) ~' u4 s- c2 P8 W& o9 _
以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.
+ m8 e" S7 A( \9 Q8 Q& W* u4 s0 \swarm.SignatureNotFoundException7 ?" C# T: \7 W1 c! b: q
        at swarm.Selector.<init>(Selector.java:76)
7 V0 y% Y, D% T' O9 j        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)/ M) n2 z. C6 k1 i9 Q
        at ActionGroupDemo.main(ActionGroupDemo.java:67)" ^* C' _1 C: P& M: ^2 g6 {

1 D6 }+ c5 v) c* _0 h/ J
9 U0 A1 Q$ j# \1 M2 q) }import swarm.objectbase.SwarmImpl;: }) P4 k, s1 G
import swarm.objectbase.Swarm;
4 ^" h' g' M7 _1 D; L7 Limport swarm.activity.ScheduleImpl;& R6 `9 X+ ?+ W7 f  O4 j2 ~# u4 a$ y5 r; U
import swarm.activity.Activity;5 u5 D/ O9 T- L0 c5 v4 j5 M2 `. N2 k% y
import swarm.activity.ActionGroupImpl;
1 w1 \3 Y; C$ {" W! Limport swarm.collections.ListImpl;
# T: h* H' }* D' R# q: f' Iimport swarm.defobj.Zone; ! O; S  L+ \9 F& g3 M- h
import swarm.Globals;
& d, Q5 d8 I9 f4 {3 `import swarm.Selector;
& o. N5 i/ ?/ _; nimport swarm.activity.ActionGroup; . O5 i0 a7 w! b6 S" D" f
class Agent {9 p) ~! q, P! l4 a5 U0 d
        char id;
) \5 t, f  V0 Q1 S, P2 g' S. q
/ W$ v7 o/ O( f/ w3 V        Agent(char id) {3 ?; q( n0 o6 l% W5 `) y
                this.id = id;* T7 U3 z1 P" n. Y1 \$ q; b! h
        }) b1 v; x4 r! J8 f+ L

7 }- X3 D' Q. ^& f* J  Q& g        public void agentStep() {
& O7 N) {, T, ]; S8 Q4 n. D1 K                System.out.println(id + ":" + Globals.env.getCurrentTime());5 j7 I/ |: O6 ^
        }
+ {5 y3 V/ H7 [}
- j$ \8 f* ~& ^9 z0 K
$ A6 P, F: q! {6 ypublic class ActionGroupDemo extends SwarmImpl {
# T4 t0 }. O7 J- ]5 u7 z        ScheduleImpl schedule;
, O4 t9 m' }% I' `2 f5 R( y) X        ActionGroupImpl actionGroup;
) _1 \  N! D7 y5 d8 u; v        ListImpl list;
# t2 X6 y, T5 t        char Id = 'a';
  d/ y) L6 f  M( k) M$ f- ^& t, I' t( `8 c" u* j. v* [' C
        ActionGroupDemo(Zone aZone) {. ?" q9 m8 `, G9 t3 [; S
                super(aZone);; F9 _" @6 o; ?
                list = new ListImpl(aZone);4 O* f, M( T' k
                swarmSetp();
' R. _, ~2 Y  f( w" x. }9 F                actionGroup = new ActionGroupImpl(aZone);
9 e# ~& g; V+ M3 t                schedule = new ScheduleImpl(aZone);
/ a' U. L7 _# O$ Q9 y  S& ~( X                try {: ^. o' e6 a+ [0 o% q  F
                        Selector agentSel = new Selector(Agent.class, "agentStep", false);
. L2 ?. {5 ?, [6 n4 ]8 P- M                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行
) t$ N: }# a& ?" Q' I6 H1 g                        
3 \2 M" f) M1 O- J* V1 w                        actionGroup.createActionForEach$message(list, agentSel);- s" H4 w8 H1 E5 Z
                        actionGroup.createActionTo$message(this, swarmSel);  j5 h; |6 N0 l$ `; K% b
                        schedule.at$createAction(0, actionGroup);1 f' b/ b6 a8 F0 m) `
                        schedule.at$createAction(1, actionGroup);3 @  `. x- m6 B
                        schedule.at$createAction(2, actionGroup);
+ Y- [8 V' O0 }6 [
) ?; _& V" G8 V# e9 Y4 y                } catch (Exception e) {( `& F' {' F4 ?) d$ @/ ]6 K
                        e.printStackTrace(System.err);* Z( n- n( f( _' U- a
                        //System.out.println(e);- t9 o3 G7 }8 i
                        System.exit(1);  i& A$ }& t- @$ ]  }
                }
& E% Z- `! u3 U+ s/ g. T- m" j6 e! ~/ i: h3 E: u
7 z8 I# j* F& ~; v+ J
        }
8 s$ o) N, \" ]/ c! X$ t- G
) ?0 V, }9 H( |" s7 C        private void swarmSetp() {- M7 S6 @. T7 a( T
                list.addLast(new Agent(Id));# {" {( l; C' t- L) Z2 U
                Id++;) I. l. Z' J) S% J
        }) b! x% D0 Y, d: j

" T$ Z# R( K# B* b0 I( u        public Activity activateIn(Swarm context) {6 H0 S/ {& R( R7 F. t% _$ z$ U
                super.activateIn(context);/ S( I" N# i; g- Y, R
                schedule.activateIn(this);
, }& n  v3 G, Z                return getActivity();* ]! W) P  Q* l
        }: y* x. m" ^, |* i! E' `5 ]
: o% G) X, Q6 f4 ~
        public static void main(String[] args) {5 k9 n' H1 s5 L3 g: @& H
                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);0 y+ I; A( o9 H2 v) q
                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);
+ ?7 ^5 M9 q0 m; {9 A                swarms.buildObjects();
7 Z; _* b; u  U6 g& g2 n( g                swarms.buildActions();2 f  D7 Y( ?3 ?7 E+ L0 [6 U$ x
                swarms.activateIn(null).run();) w$ S" K  ^7 j. }3 e3 k( q
        }4 E3 s5 E- @5 {

7 p  X8 w0 ]$ H}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-11-15 01:34 , Processed in 0.015004 second(s), 15 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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