在groovy出现下述程序,但在gasnode groovy里显示错误,请帮助解决 2 q) X1 Z0 ]# L# ]4 Z 7 a2 m2 [9 ~; r' C T9 i& H! ~- _+ x% {5 B4 ?# N. J' A8 f
@Parameter (displayName = "Measured Pressure", usageName = "measured pressure")3 C0 ~- n0 H3 e
public double getMeasured pressure() {2 C" L8 b5 @0 E B
return measured pressure) Y- s+ d e2 G, K6 x7 V2 |/ Y
}& m8 |3 S' ?9 U) r) p
public void setMeasured pressure(double newValue) { * `1 Y: Z) ~$ A: a' D measured pressure = newValue! X# k" L- I b! v: d+ U1 ?
} ! M# W: K" i' ^$ i) m9 O' x6 ~ public double measured pressure = 0 % Z: H3 f& ?6 F3 A' y R0 p8 L2 i4 ?' Z& V
/** ; ?7 s/ _" v4 i3 g4 {6 r( Q/ ]; R *- J+ w( _( b) F4 J( U5 F. {
* This value is used to automatically generate agent identifiers. p0 x: u9 a$ W: {- F
* @field serialVersionUID% I' b/ l9 ?2 Y# s4 ^
*- ^' y2 m9 n# i) f1 D8 B
*/ 0 f5 J2 _: G" o* v5 S, f: N9 |9 e private static final long serialVersionUID = 1L/ ]$ t, o _3 H8 H
" c% k E% q9 Z /** 8 i$ { x$ B2 T: w * 3 ~/ F( u, R4 F( | T* ^ * This value is used to automatically generate agent identifiers. 7 L+ c( z8 P7 m1 p5 N8 {8 a% [( z * @field agentIDCounter 1 d5 J2 ?- ], d) a3 X7 M8 z. H3 x *" l$ G0 ^+ Y* @* \2 A( p% n
*/2 L% t3 L; d2 K8 I" ?, |' m
protected static long agentIDCounter = 11 N- C: N' U, z! W- ^" u
& j3 j4 t" F: ?5 v5 P /**3 b7 {1 E5 D3 W; P+ j, N7 Y5 D, I% B
*" B1 b; N$ N) Q) v
* This value is the agent's identifier.9 y" ]- V: c' {1 h' W, Q# v
* @field agentID7 H/ j9 ^6 d# H8 D9 S8 m
* : H9 c$ P! w6 Q( y; n */ 4 |$ e; ]9 u$ z, W \3 t/ C) a; w9 j protected String agentID = "GasNode " + (agentIDCounter++) ' W; I; h* u7 J* R' N * p' V; A0 j& ?0 C. a; H /**/ K4 }+ F: g7 C1 {. M- D/ e. Q
*' H, A9 I8 I8 j, s+ F0 `5 C
* This is the step behavior. " I; d- h# G" X2 |0 y * @method step3 u* O9 W9 l& V1 i
*6 t) W( V. L k; t7 j# d, E
*/2 D- M! l6 o w5 R/ Z# G
@Watch( y8 w2 X( o% k2 Q0 ?" m
watcheeClassName = 'infrastructuredemo.GasNode',; i- M$ C1 @2 V( K& v/ I* w* i$ y
watcheeFieldNames = 'pressure',/ ?4 @$ o+ g' J: ]6 u; Z
query = 'linked_from',' w# c) X7 {9 t! z& k9 X
whenToTrigger = WatcherTriggerSchedule.LATER, ; ?( Y1 `/ Y* k% ~1 }# x scheduleTriggerDelta = 10d' a) v8 F* V! t7 A' ~2 z- P" {! ~
) % T2 a( B% o8 k% e0 i+ i public def step(infrastructuredemo.GasNode watchedAgent) {# j& v7 g8 K* d0 p: X+ a! V0 X( {
注意,在函数step中 3 i/ Z F8 w2 z& @7 k f7 X public def step(infrastructuredemo.GasNode watchedAgent) { $ s, }" E5 K$ ~4 F. H5 F //这里是watchedAgent 9 P/ |. K1 T( L4 s& o 但是在语句中,你填的是watchedNode % s6 C3 O' Y; e2 Z // This is an agent decision. 5 C. q( ^9 o% c& Z if (watchedNode.pressure<200) { ) S" _1 ?6 { Y8 h' f1 u setPressure(watchedAgent.pressure)& F3 R) ~) p, D
变量名称须统一,可以都改为watchedAgent