本文整理匯總了Java中org.aikodi.rejuse.predicate.UniversalPredicate.downCastedList方法的典型用法代碼示例。如果您正苦於以下問題:Java UniversalPredicate.downCastedList方法的具體用法?Java UniversalPredicate.downCastedList怎麽用?Java UniversalPredicate.downCastedList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.aikodi.rejuse.predicate.UniversalPredicate
的用法示例。
在下文中一共展示了UniversalPredicate.downCastedList方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parent
import org.aikodi.rejuse.predicate.UniversalPredicate; //導入方法依賴的package包/類
/**
* Return a list of all ancestors of the given type. A closer ancestors will have a lower index than a
* farther ancestor.
*
* @param predicate A predicate that determines which ancestors should be returned.
*/
/*@
@ default behavior
@
@ post \result != null;
@ post parent() == null ==> \result.isEmpty();
@ post parent() != null && predicate.eval(parent()) ==> \result.get(0) == parent()
@ && \result.subList(1,\result.size()).equals(parent().ancestors(c));
@ post parent() != null && ! predicate.eval(parent()) ==>
@ \result.equals(parent().ancestors(c));
@*/
default <X extends T, E extends Exception> List<X> ancestors(UniversalPredicate<X, E> predicate) throws E {
return predicate.downCastedList(ancestors());
}
示例2: post
import org.aikodi.rejuse.predicate.UniversalPredicate; //導入方法依賴的package包/類
/**
* Return all children of this element that are of the given type, and satisfy the given predicate.
*
* @param predicate A predicate that determines which ancestors should be returned.
*/
/*@
@ default behavior
@
@ pre predicate != null;
@
@ post \result != null;
@ post (\forall Element e; ; \result.contains(e) <==> children().contains(e) && predicate.eval(e));
@*/
default <X extends T, E extends Exception> List<X> children(UniversalPredicate<X,E> predicate) throws E, N {
return predicate.downCastedList(children());
}