當前位置: 首頁>>代碼示例>>Java>>正文


Java UniversalPredicate.downCastedList方法代碼示例

本文整理匯總了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());
 }
 
開發者ID:markovandooren,項目名稱:rejuse,代碼行數:20,代碼來源:TreeStructure.java

示例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());
 }
 
開發者ID:markovandooren,項目名稱:rejuse,代碼行數:17,代碼來源:TreeStructure.java


注:本文中的org.aikodi.rejuse.predicate.UniversalPredicate.downCastedList方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。