The following features are supported:
Multiple conditions can be included in a single statement, and all conditions must evaluate to true in order for the statement to take effect.
The set of conditions is D in the statement "A has permission to do B to C where D applies."
A condition is composed of three parts:
There are many expressive conditions available in the com.amazonaws.auth.policy.conditions
package to use in access control policy statements.
This class is not intended to be directly subclassed by users, instead users should use the many available conditions and condition factories in the com.amazonaws.auth.policy.conditions package.
Represents a selection criteria for a Query or Scan operation.
For a Query operation, the condition specifies the key attributes to use when querying a table or an index.
For a Scan operation, the condition is used to evaluate the scan results and return only the desired values.
Multiple conditions are "ANDed" together. In other words, all of the conditions must be met to be included in the output.
A {@link Condition} defines a boolean condition that can be valid or invalid. {@link Condition}s are used in {@link Query}s to define {@link Rule}s.
By default Passe-Partout comes with a set of implemented {@link Condition}s that can be created using the {@link PassePartout} class. In rare cases you need to implement your own {@link Condition} to define even moredetailed queries.
@see PassePartout @since 0.9查询过滤条件
User: Zhang Kaitao
Date: 13-1-15 上午7:12
Version: 1.0
The following features are supported:
Conditions (also known as condition queues or condition variables) provide a means for one thread to suspend execution (to "wait") until notified by another thread that some state condition may now be true. Because access to this shared state information occurs in different threads, it must be protected, so a lock of some form is associated with the condition. The key property that waiting for a condition provides is that it atomically releases the associated lock and suspends the current thread, just like {@code Object.wait}.
A {@code Condition} instance is intrinsically bound to a lock.To obtain a {@code Condition} instance for a particular {@link Lock}instance use its {@link Lock#newCondition newCondition()} method.
As an example, suppose we have a bounded buffer which supports {@code put} and {@code take} methods. If a{@code take} is attempted on an empty buffer, then the thread will blockuntil an item becomes available; if a {@code put} is attempted on afull buffer, then the thread will block until a space becomes available. We would like to keep waiting {@code put} threads and {@code take}threads in separate wait-sets so that we can use the optimization of only notifying a single thread at a time when items or spaces become available in the buffer. This can be achieved using two {@link Condition} instances.
class BoundedBuffer { final Lock lock = new ReentrantLock(); final Condition notFull = lock.newCondition(); final Condition notEmpty = lock.newCondition(); final Object[] items = new Object[100]; int putptr, takeptr, count; public void put(Object x) throws InterruptedException { lock.lock(); try { while (count == items.length) notFull.await(); items[putptr] = x; if (++putptr == items.length) putptr = 0; ++count; notEmpty.signal(); } finally { lock.unlock(); } } public Object take() throws InterruptedException { lock.lock(); try { while (count == 0) notEmpty.await(); Object x = items[takeptr]; if (++takeptr == items.length) takeptr = 0; --count; notFull.signal(); return x; } finally { lock.unlock(); } } }(The {@link java.util.concurrent.ArrayBlockingQueue} class providesthis functionality, so there is no reason to implement this sample usage class.)
A {@code Condition} implementation can provide behavior and semanticsthat is different from that of the {@code Object} monitor methods, such asguaranteed ordering for notifications, or not requiring a lock to be held when performing notifications. If an implementation provides such specialized semantics then the implementation must document those semantics.
Note that {@code Condition} instances are just normal objects and canthemselves be used as the target in a {@code synchronized} statement,and can have their own monitor {@link Object#wait wait} and{@link Object#notify notification} methods invoked.Acquiring the monitor lock of a {@code Condition} instance, or using itsmonitor methods, has no specified relationship with acquiring the {@link Lock} associated with that {@code Condition} or the use of its{@linkplain #await waiting} and {@linkplain #signal signalling} methods.It is recommended that to avoid confusion you never use {@code Condition}instances in this way, except perhaps within their own implementation.
Except where noted, passing a {@code null} value for any parameterwill result in a {@link NullPointerException} being thrown.
When waiting upon a {@code Condition}, a "spurious wakeup" is permitted to occur, in general, as a concession to the underlying platform semantics. This has little practical impact on most application programs as a {@code Condition} should always be waited upon in a loop, testingthe state predicate that is being waited for. An implementation is free to remove the possibility of spurious wakeups but it is recommended that applications programmers always assume that they can occur and so always wait in a loop.
The three forms of condition waiting (interruptible, non-interruptible, and timed) may differ in their ease of implementation on some platforms and in their performance characteristics. In particular, it may be difficult to provide these features and maintain specific semantics such as ordering guarantees. Further, the ability to interrupt the actual suspension of the thread may not always be feasible to implement on all platforms.
Consequently, an implementation is not required to define exactly the same guarantees or semantics for all three forms of waiting, nor is it required to support interruption of the actual suspension of the thread.
An implementation is required to clearly document the semantics and guarantees provided by each of the waiting methods, and when an implementation does support interruption of thread suspension then it must obey the interruption semantics as defined in this interface.
As interruption generally implies cancellation, and checks for interruption are often infrequent, an implementation can favor responding to an interrupt over normal method return. This is true even if it can be shown that the interrupt occurred after another action that may have unblocked the thread. An implementation should document this behavior. @since 1.5 @author Doug Lea
A Room's precondition can be considered the set of Symbols from the other Rooms that the player must have collected to be able to reach this room. For instance, if the Room is behind a locked door, the precondition for the Room includes the key for that lock.
In practice, since there is always a time ordering on the collection of keys, this can be implemented as a count of the number of keys the player must have (the 'keyLevel').
The state of the {@link Dungeon}'s switch is also recorded in the Condition. A Room behind a link that requires the switch to be flipped into a particular state will have a precondition that includes the switch's state.
A Condition is 'satisfied' when the player has all the keys it requires and when the dungeon's switch is in the state that it requires.
A Condition x implies a Condition y if and only if y is satisfied whenever x is.
A condition can prevent a transition from firing, based on the current situation. Examples:
String[] onProvideCompletionsFromMyField(String input) { return . . .; }
new Condition("std.id=?",new Long(2)); 或者 Condition("std.id=:std_id",new Long(2)); ?绑定单值.命名参数允许绑定多值.但是只能由字母,数组和下划线组成 一组condition只能采取上面一种形式
@author chaostone
Condition
that filters facts.
@see Tuple
@author bob mcwhirter
历史更新记录: 2005-07-16 创建此类型@author wenjian @version 1.0 @since JThink 1.0
Nutz.Dao 默认提供给你 Cnd 类,便于你快速构建你的条件语句。
这个接口也提供另外一种可能:
比如你的 Web 应用,可以通过 Request,根据用户提交的数据 生成 一个这个接口的实例。这个过程你可以写的很通用。
@author zozoh(zozohtnt@gmail.com)
@see org.nutz.dao.Cnd
Conditions are checked immediately before the bean-definition is due to be registered and are free to veto registration based on any criteria that can be determined at that point.
Conditions must follow the same restrictions as {@link BeanFactoryPostProcessor}and take care to never interact with bean instances. For more fine-grained control of conditions that interact with {@code @Configuration} beans consider the{@link ConfigurationCondition} interface. @author Phillip Webb @since 4.0 @see ConfigurationCondition @see Conditional @see ConditionContext
addCustomEvent( new Condition("triggerhit") { public boolean test() { return (getEnergy() <= trigger); }; } );You should note that by extending Condition this way, you are actually creating an inner class -- so if you distribute your robot, there will be multiple class files. (i.e. {@code Target$1.class}) @see AdvancedRobot#waitFor(Condition) @see AdvancedRobot#addCustomEvent(Condition) @see AdvancedRobot#removeCustomEvent(Condition) @see AdvancedRobot#onCustomEvent(CustomEvent) @author Mathew A. Nelson (original) @author Flemming N. Larsen (contributor) @author Nathaniel Troutman (contributor)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|