设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 12643|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑
2 [' c6 |3 s0 I8 T1 F: M+ z" p0 f: e+ [7 b0 j
本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21' b/ ^8 G; i! b5 K
以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.
: P0 q% ]( j0 h7 R1 C9 z5 G# kswarm.SignatureNotFoundException, `, d8 J. f& h' c1 y
        at swarm.Selector.<init>(Selector.java:76)
" R$ N' |5 r) \/ N% C4 }' L        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)5 u# G  ?5 |% m6 E* Q
        at ActionGroupDemo.main(ActionGroupDemo.java:67)( @: l5 i9 a0 U0 |3 C5 g8 \! X

( D+ L  u3 G8 i' u) J9 c( d1 a6 T5 Z6 k* i" u4 ]
import swarm.objectbase.SwarmImpl;
1 T: r3 e7 |9 `5 k2 Eimport swarm.objectbase.Swarm;
6 v' K  b! D$ ?# h9 }- `import swarm.activity.ScheduleImpl;' Q3 b* D- x; O: W; G7 o
import swarm.activity.Activity;& |8 n; b; g* f
import swarm.activity.ActionGroupImpl;. b8 Q( X! I9 M0 }
import swarm.collections.ListImpl;
! [+ F* e. y1 J  K# ^import swarm.defobj.Zone;
% J* ~# x/ e/ ]import swarm.Globals;
  t2 u/ ?3 V( J: p3 x0 Timport swarm.Selector;8 L4 f) t6 Y0 B3 l! F% w  s$ H
import swarm.activity.ActionGroup;
: c% ?* }$ ?/ u* y' \class Agent {1 k% ?( Q5 f- u, r0 F8 H# e# N
        char id;: z+ w5 K$ v) \1 `% ?# [

3 W4 p+ l$ x2 r& R6 t; A' b        Agent(char id) {& o- U" Y* v% q; o- k6 D7 z% u
                this.id = id;& i5 {$ w3 G. I: I. n: j( n
        }
  |5 k4 T: n2 y. _3 K& w# s
0 P7 A" B" x: |  i0 K2 D6 X        public void agentStep() {
% d% T; D* r3 O- ]9 U                System.out.println(id + ":" + Globals.env.getCurrentTime());; V. s) }) X  u1 m$ f* D# c
        }6 e; ]! I7 m  Z/ Z
}
" N& T% Z! T! x0 _1 A/ p$ W  c, z! B6 [" A- G& D7 `: T
public class ActionGroupDemo extends SwarmImpl {: X% |* S- {  C! O
        ScheduleImpl schedule;
$ X, ~6 `! V8 Z! L7 O* I) {+ M        ActionGroupImpl actionGroup;
, p! o- \5 J" n1 j/ [" T        ListImpl list;! t+ l3 o' _6 q
        char Id = 'a';
1 H- N! w1 S+ y* }3 a& w# l
' T8 [4 u% {3 v' j! O: o) Z, g        ActionGroupDemo(Zone aZone) {
6 t: ]; F% h. M# M0 U" ^                super(aZone);+ y% I* ]& s$ Z1 d! J1 y
                list = new ListImpl(aZone);  B3 B5 ~6 x4 O1 c# Y/ H' m* S
                swarmSetp();4 U2 ]: w& |' @4 e' |( S" g. u& x
                actionGroup = new ActionGroupImpl(aZone);6 ]0 `! u5 L: {6 k! [% P! A4 t
                schedule = new ScheduleImpl(aZone);
7 w: L& @* ^8 _2 y1 x7 h# N1 o                try {* J# ]1 g" y" c5 j4 h
                        Selector agentSel = new Selector(Agent.class, "agentStep", false);
: t+ W3 _3 I% a  U9 t                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行
4 o8 @; O& e  U, L# L/ s, }2 a                        ) h& n( q6 u% N/ E
                        actionGroup.createActionForEach$message(list, agentSel);, K8 o: t: i) Y7 O
                        actionGroup.createActionTo$message(this, swarmSel);
: i% N2 h- l2 Y9 M/ {( y" E                        schedule.at$createAction(0, actionGroup);
9 i9 L, h8 W% y; L4 n- t8 W                        schedule.at$createAction(1, actionGroup);
+ Z/ x" j3 A$ q, h; k                        schedule.at$createAction(2, actionGroup);7 R4 k, t5 [- Z: ~+ N5 m  |
, z0 `3 s$ z' ~+ L$ q1 A
                } catch (Exception e) {
, g5 \  @% |9 c3 }                        e.printStackTrace(System.err);+ W. j7 [5 d5 G  n7 _* B  p
                        //System.out.println(e);
  |: u6 D9 Y2 a9 k# I5 O                        System.exit(1);1 Z0 G4 l2 X: A
                }) H1 o0 j" O2 V0 b* P7 z5 c! h  m
8 b# }1 U- p# A8 L; u# u! t/ ^) x

, R: C0 i% C" D! I! q* T        }+ M* t- c' S, \7 c6 e
6 T9 w# I/ N: |- F
        private void swarmSetp() {- `! {0 o# @/ Y* w5 G8 d" r5 j4 V
                list.addLast(new Agent(Id));
5 U% w7 t: |& ]) c5 G) d$ f                Id++;" K" u! u2 ]# O/ l
        }
4 l$ ^& P3 E$ @( r  r& b4 ]% p: y. w+ Y) y" f  e
        public Activity activateIn(Swarm context) {
/ s( i2 K- C9 s. R' c/ i1 T# V                super.activateIn(context);
0 l" D& p- E* u# u4 B9 R                schedule.activateIn(this);8 q# p' u) @( W% e9 f- c
                return getActivity();
7 ?5 |; J& U( R9 s5 p        }
% _# k$ ~4 f& a/ k) o  H. T; V, R: g' b4 T8 l4 K
        public static void main(String[] args) {
3 p: K5 \+ j, p2 r& T- W                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);
) {5 p7 S1 M6 n9 a1 }+ b                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);8 m! Q% ]4 m' \
                swarms.buildObjects();
' c) G2 E2 ]" j& @, t9 o8 D* R$ a. R                swarms.buildActions();; I' ^5 X9 m$ z$ o% n0 N5 }
                swarms.activateIn(null).run();
4 Z# W6 d: Y7 U4 }. G( ^        }- S, c( ^3 s1 t& z

; L8 |9 I; T9 n  A% C+ C1 D}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-8-14 16:56 , Processed in 0.015368 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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