设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 6599|回复: 1

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

  [复制链接]
发表于 2010-11-11 10:28:14 | 显示全部楼层 |阅读模式
本帖最后由 generate2000 于 2010-11-11 10:46 编辑 3 o+ F! ~$ T6 {
1 \8 U2 Q" }; d
本人swarm菜鸟,有个问题请教下下.swarm2.2,jdk1.6update21
- h0 a5 Z+ J  E以下是actiongroupdemo程序,在执行时出现以下错误.请各位高手帮忙解决一下,不胜感激.' E# ^! E% M) h, V6 V
swarm.SignatureNotFoundException
6 Q) b) c# {- n1 n        at swarm.Selector.<init>(Selector.java:76)( g& \$ x# v9 z. C8 Y# c( A( f
        at ActionGroupDemo.<init>(ActionGroupDemo.java:37)- F' a! P" s, S7 |0 v; N& B
        at ActionGroupDemo.main(ActionGroupDemo.java:67)" ^. y! C- K. K' p

; x3 b* M/ O) ]3 v0 x3 F# {1 b/ N* f" w9 P9 i% c
import swarm.objectbase.SwarmImpl;# U) @" V2 e& D/ R$ H8 Q: V; a4 [
import swarm.objectbase.Swarm;
2 Y8 H( t4 m9 p/ X2 w7 Cimport swarm.activity.ScheduleImpl;( G' @" R: a* R5 S1 E+ Z5 l
import swarm.activity.Activity;5 i7 r# z) t8 Z& }
import swarm.activity.ActionGroupImpl;
% r2 S5 U- e& @( `& T6 {: `. limport swarm.collections.ListImpl;0 q8 `8 C3 v6 s+ n
import swarm.defobj.Zone;
7 M' N6 |; _1 `- pimport swarm.Globals;
6 @8 d& i! R0 Z* b- k; A* p+ v: Rimport swarm.Selector;2 y, ]9 z9 G, e% f: l
import swarm.activity.ActionGroup; ) r3 p# D6 Z; W# Z! J+ i" `
class Agent {
# V& T3 o! {2 m8 j6 t7 r) Y        char id;
8 x- u+ H& C' x% g$ Y" \( N* a* f2 I; p/ f' x1 O6 y2 x
        Agent(char id) {
& K0 G' o$ o, |                this.id = id;
& V0 V5 C* a5 s! U! {        }
" L" t6 f% `9 i& B+ B& y/ e3 O# T* C6 P8 Q4 r  r% q5 s. b7 q
        public void agentStep() {
9 n: O3 u9 [, J8 Q                System.out.println(id + ":" + Globals.env.getCurrentTime());% f  H% z: v7 b" }. H, C% h' w
        }
- A8 p; X* p" y}
0 U: i! S& m3 n* B
& T' f# F4 R6 q' j9 _) Q# `public class ActionGroupDemo extends SwarmImpl {% B8 |3 Q9 o0 @
        ScheduleImpl schedule;" E# U% j2 Q9 X& N, D/ w7 a
        ActionGroupImpl actionGroup;
) R& n9 G4 w5 p, ^4 Q* p        ListImpl list;
$ G$ X/ v6 Z( [4 `: ]4 x        char Id = 'a';
. A: i' U* p+ G2 H/ H
' Q* u1 y6 [* U1 J" @* A( A        ActionGroupDemo(Zone aZone) {
, {! ^1 g" y7 G. t                super(aZone);
8 a2 T) x" E' J1 A                list = new ListImpl(aZone);& ^% g" P& [' U5 Z, I
                swarmSetp();( u# c- k: E3 A" I3 H7 w4 U5 A
                actionGroup = new ActionGroupImpl(aZone);
  K$ ~: T! J, J0 o                schedule = new ScheduleImpl(aZone);3 j" ~; U5 t, z' C( M+ s  l
                try {
  L  l. V! t7 |                        Selector agentSel = new Selector(Agent.class, "agentStep", false);' E' [) I- E. A
                        Selector swarmSel = new Selector(ActionGroupDemo.class,"swarmSetp", false);//问题就出现在这一行% v7 A& ~$ H. w# R# X  T
                        0 @- d( o5 H5 c1 ?% Y! @1 C
                        actionGroup.createActionForEach$message(list, agentSel);
8 X+ t9 H; [! J6 a  `- n. @3 z' G                        actionGroup.createActionTo$message(this, swarmSel);6 T) T. L: u3 y& X# }) U; z
                        schedule.at$createAction(0, actionGroup);. i/ H) E! f' u! d  z* x( X/ {1 F
                        schedule.at$createAction(1, actionGroup);
- i# C. R: G* o5 _! ^. d5 q                        schedule.at$createAction(2, actionGroup);
) U* o% V$ c* \5 y% a
( }! K* L( i$ G4 U5 g6 n$ d                } catch (Exception e) {$ Z- ^& S" \" q* g8 B; I. x& f8 t
                        e.printStackTrace(System.err);
1 k7 \# d  A3 M0 f                        //System.out.println(e);6 U" V6 N  d9 r
                        System.exit(1);2 h# y6 |6 g5 l5 d6 X6 n. l
                }4 v. H$ r4 \( K1 r! N
- ?0 h9 X  d1 H
) G6 i9 `% Q% h
        }* X7 s8 y% A5 n

7 Z7 S9 r* [( [5 l: K' i$ @        private void swarmSetp() {! S) v7 ?' e+ |" t
                list.addLast(new Agent(Id));9 E0 a) a6 A- d' f3 `5 ~
                Id++;+ u# t) x3 q$ z
        }. W) }# R. t; w1 O
+ A: O8 |) F& w
        public Activity activateIn(Swarm context) {
' U4 X* e* }( u3 h                super.activateIn(context);9 s1 M% a- r/ T* Y% b4 o
                schedule.activateIn(this);
4 h0 u3 o* X+ L& N                return getActivity();
' T/ X; g7 P. r% B7 \* h. Z        }
2 R/ V3 N, S; m; }9 l+ y" p  \* D% }4 q; u! \& c5 D. C
        public static void main(String[] args) {
- a1 Q5 l2 f4 i; S, r% d+ L                Globals.env.initSwarm("ActionGroupdemo", "1.1", "s@s", args);  f$ R; S; b$ j' U$ R
                Swarm swarms = new ActionGroupDemo(Globals.env.globalZone);
9 h/ u( g, U3 n+ `. l- X) f2 |0 Q                swarms.buildObjects();
' ]2 V: J* L1 o8 L6 K                swarms.buildActions();
4 t! J9 H" H. E& P9 l$ U                swarms.activateIn(null).run();
+ z) j% E6 a$ R5 [& Y        }0 J/ ^$ N/ ^8 g

1 C5 U4 v# e  N. S}
发表于 2010-11-22 22:09:23 | 显示全部楼层
你的函数swarmStep 不能为private 要是public才行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-2-2 16:42 , Processed in 0.017152 second(s), 15 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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