コード例 #1
0
ファイル: IEntityDefn.java プロジェクト: phil-rice/fastorm
 public static <From, To> To fold(
     IEntityDefn primary,
     To initial,
     IEntityDefnFoldVisitor<From, To> visitor,
     IFoldFunction<From, To> foldFunction) {
   To accumulator = foldFunction.apply(visitor.acceptPrimary(primary), initial);
   return visitChildren(primary, accumulator, visitor, foldFunction);
 }
コード例 #2
0
ファイル: IEntityDefn.java プロジェクト: phil-rice/fastorm
 private static <To, From> To visitChildren(
     IEntityDefn parent,
     To initial,
     IEntityDefnFoldVisitor<From, To> visitor,
     IFoldFunction<From, To> foldFunction) {
   To accumulator = initial;
   for (IEntityDefn child : parent.getChildren()) {
     accumulator = foldFunction.apply(visitor.acceptChild(parent, child), accumulator);
     accumulator = visitChildren(parent, accumulator, visitor, foldFunction);
   }
   return accumulator;
 }