org.erights.e.elib.slot
Class UnionGuard
java.lang.Object
|
+--org.erights.e.elib.slot.BaseGuard
|
+--org.erights.e.elib.slot.UnionGuard
- All Implemented Interfaces:
- Guard, SlotGuard, ValueGuard
- public class UnionGuard
- extends BaseGuard
Safe: Composes a sequence of guards to form a union type.
Since this operation is associative, we represent directly only a sequence
of two. A binary tree then represents any sequence. Reports the first
success or the last failure.
- Author:
- Mark S. Miller
Methods inherited from class org.erights.e.elib.slot.BaseGuard |
__printOn, accepts, and, butNot, coerce, get, makeSlot, makeSlot, not, or, toString, xor |
myLeftGuard
private final ValueGuard myLeftGuard
myRightGuard
private final ValueGuard myRightGuard
UnionGuard
public UnionGuard(ValueGuard leftGuard,
ValueGuard rightGuard)
- Enabled:
- Parameters:
leftGuard
- rightGuard
-
coerce
public Object coerce(Object specimen,
OneArgFunc optEjector)
- Enabled:
- Specified by:
coerce
in interface ValueGuard
- Overrides:
coerce
in class BaseGuard
getName
public String getName()
- Enabled: "(leftGuard | rightGuard)[]"
- Specified by:
getName
in interface SlotGuard
- Overrides:
getName
in class BaseGuard
comments?