It ACTS like a macro in this context, where calling the method of function via the closure makes the function call in the context of where it's defined.
它在此上下文中用作宏,通过闭包调用函数方法将在定义它的上下文中执行函数调用。
To solve this, we can push that method call into a closure and make the calls against that closure, instead. The resulting code is shown below.
为了解决此问题,我们可以把该方法调用放入闭包并转而针对该闭包执行调用。
But this usage is in a closure, so this code actually executes in the context of the collect method!
但此项用法是在一个闭包里进行的,所以这段代码实际上是在collect方法的上下文中执行的!
In gpars, actors can be created from a factory method that takes a closure or by subclassing groovyx.gpars.actor.AbstractPooledActor.
在gpars中,可以利用接受闭包的factory方法或通过为groovyx . gpars . actor . AbstractPooledActor划分子类来创建actors。
Because it is a Seq, it has a foreach method that takes a closure as a parameter.
因为它是一个Seq,它具有一个foreach方法,并将一个闭包作为参数。
Each method call and optional closure argument defines a bean and sets bean properties.
每个方法调用和可选的闭包参数定义一个bean,并设置bean属性。
The iterator method collect, for example, applies a closure to every element in a collection and returns a new collection with the new values.
例如,迭代器方法collect把闭包应用到集合中的每个元素上,并返回一个带有新值的新集合。
Note that where the final parameter to a method is a closure, Groovy permits that you can remove it from the list of actual parameters and place it immediately after the closing parenthesis.
注意方法的最后一个参数是个闭包,在这个地方Groovy允许把它从实际参数列表中删除,并把它直接放在结束括号后面。
The closure captures the information about the actual Web service method stub to be invoked (the function object called obj) as well as the stream for the log output.
闭包捕获真正被调用的Web服务方法存根(称为obj的函数对象)以及流作为日志输出。
A subtle but important difference between auth and list is that list is a closure, whereas auth is a private method. (Closures use an equals sign in the definition; methods use parentheses.)
auth和list之间微妙但重要的一点区别是list是一个闭包,而auth是一个私有方法(闭包在定义中使用等号;方法使用圆括号)。
Calling the object reference shown in Listing 9 as a variable automatically calls the __invoke magic method, making the class itself act as a closure.
将清单9中所示的对象引用调用为变量将自动调用__invoke魔术方法,使类本身用作闭包。
Here, we explicitly use the greeting given to the greet method in the closure defined within it.
在这里,我们在闭包内显式使用提供给greet方法的欢迎词,闭包在该方法内定义。
This allows the SQL LinQ provider to analyze the closure passed to the Where() method and translate it into SQL.
这充许SQLLinQ提供程序分析传递给Where()方法的闭包,并将它转换成 SQL。
The List referenced as ages is sent the collect() method with the single closure { element -> return element + 1 } as a parameter.
名为ages的List被发送给collect()方法,使用单个闭包 {element->return element +1 }作为参数。
To use fork/join directly, you must either use the runForkJoin() method with a task closure or a task class that subclasses AbstractForkJoinWorker.
要直接使用fork/join,您必须使用带有一个任务闭包的runForkJoin()方法或一个将AbstractForkJoinWorker分为子类的任务类。
But there is one feature of the implementation internals of the Closure class that you can exploit: its use of the new __invoke method. The __invoke magic method makes a class callable.
但是,有一个您可在内部实施的closure类中利用的特性:它使用新的__invoke方法。
Unfortunately, it will result in the error message shown in Figure 5, because the function declared in the dojo.forEach method call creates a closure that defines this as referring to its own body.
不幸的是,它将导致图5所示的错误消息,因为在dojo. forEach方法调用中声明的函数创建了一个闭包,该闭包将this定义为引用它本身。
The event command is also a method invocation, taking a symbol (which defines the event's name) and a closure, which defines the transitions.
event命令也是一个方法调用,使用 符号(定义事件名)和闭包(定义转换)作为参数。
BeforeDelete closure gets called before the delete method.
beforeDelete在delete方法执行前被调用。
BeforeUpdate closure gets called before the update method.
beforeUpdate在update方法执行前被调用。
The code has two methods — XML and HTML — that each take closures. Each method can selectively call its closure based on the contents of the accept header, as in Listing 10.
该代码有两个方法,即xml和html,每个都使用闭包。
The algorithm makes use of the characteristic of Lagrange relaxation method, and finds multicast tree satisfying constraint by constructing closure graph and making relaxation to this graph.
该算法充分利用拉格朗日松弛方法的特点,通过构建封闭图,对封闭图进行拉格朗日松弛求得满足条件的多播树。
Based on this analysis, the author has got an effective minimization method for constructing the minimal closure of the closed class of implicative compatible pairs without redundant elements.
在此基础上,提出了一个有效的极小化方法——建立无多余元素的蕴涵相容对封闭类的极小闭包的方法。
Using a closure to encapsulate other calls allows you to expose a single method which can result in calls to another service methods.
使用一个封闭的封装调用允许你公开一种方法可以导致调用另一个服务的方法。
Results incision complication was related to skill of puncture and operation, method of specimen extraction and incision closure.
结果腹腔镜手术切口并发症的发生与穿刺、手术操作技巧、标本取出方法及切口封闭方法有密切关系。
The calculated results for the approximation of valve closure problems show good agreement with that obtained by method of characteristics.
数值计算表明对单根等截面圆管阀门关断问题的计算结果与特征线方法计算结果吻合。
It is concluded that the semivariogram method of spatial statistics may be as an effective means of estimating the crown of pure forest stand with relative high crown closure.
结果表明:空间统计学半方差方法可以作为郁闭度较高纯林林分冠幅估计的一种有效方法。
Objective: To explore the effective method for cataract combined with acute angle-closure glaucoma.
目的:探讨白内障合并急性闭角性青光眼的有效治疗方法。
Emphasis is laid on the analysis, of large nonlinearities in system, for example, the FPK method, the closure method and the functional series expansion method.
重点是具有较大非线性的系统的方法,如FPK法,矩闭合法和函数级数法。
Emphasis is laid on the analysis, of large nonlinearities in system, for example, the FPK method, the closure method and the functional series expansion method.
重点是具有较大非线性的系统的方法,如FPK法,矩闭合法和函数级数法。
应用推荐