当前位置: 首页>>代码示例>>Java>>正文


Java Transformer.transform方法代码示例

本文整理汇总了Java中org.apache.commons.collections4.Transformer.transform方法的典型用法代码示例。如果您正苦于以下问题:Java Transformer.transform方法的具体用法?Java Transformer.transform怎么用?Java Transformer.transform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.collections4.Transformer的用法示例。


在下文中一共展示了Transformer.transform方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createNode

import org.apache.commons.collections4.Transformer; //导入方法依赖的package包/类
/**
 * Creates a Node from a Transformer<Trio<?,?,?>,?>.
 * @param <T> Type of the Collection entry.
 * @param <R> Return type.
 * @param t a tri-transformer that accepts a <?,?,?> and returns a <?>.
 * @param sub1 first  Node at `depth+1` in the tree.
 * @param sub2 second Node at `depth+1` in the tree.
 * @param sub3 third  Node at `depth+1` in the tree.
 * @return a new Node.
 */
public static <T,R> Node<T,R> createNode(final Transformer<Trio<Object,Object,Object>,R> t,
      final Node<T,?> sub1, final Node<T,?> sub2, final Node<T,?> sub3)
{
   return new Node<T,R>()
   {
      @Override
      public R exec(T element)
      {
         Object o1 = sub1.exec(element);
         Object o2 = sub2.exec(element);
         Object o3 = sub3.exec(element);
         return t.transform(new Trio<>(o1, o2, o3));
      }
   };
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:26,代码来源:ExecutableExpressionTree.java

示例2: compose

import org.apache.commons.collections4.Transformer; //导入方法依赖的package包/类
/**
 * Compose 2 Transformers into 1.
 * @param <A> Input type.
 * @param <B> Transition type.
 * @param <C> Output type.
 * @param first firstly invoked Transformer.
 * @param second secondly invoked Transformer.
 * @return {@code second.transform(first.transform(A))}.
 */
public static <A,B,C> Transformer<A,C> compose(Transformer<A,B> first,
      Transformer<? super B,C> second)
{
   final Transformer<A,B> ffirst  = first;
   final Transformer<? super B,C> fsecond = second;
   return new Transformer<A,C>()
   {
      @Override
      public C transform(A u)
      {
         return fsecond.transform(ffirst.transform(u));
      }
   };
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:24,代码来源:FunctionalTools.java

示例3: createLeave

import org.apache.commons.collections4.Transformer; //导入方法依赖的package包/类
/**
 * Creates a dynamic leave from a Transformer.
 * @param <T> Type of the Collection entry.
 * @param <R> Return type.
 * @param p Transformer that provides us data from the collection entry.
 * @return a new Node.
 */
public static <T,R> Node<T,R> createLeave(final Transformer<T,R> p)
{
   return new Node<T,R>()
   {
      @Override
      public R exec(T element)
      {
         return p.transform(element);
      }
   };
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:19,代码来源:ExecutableExpressionTree.java

示例4: createDuoNode

import org.apache.commons.collections4.Transformer; //导入方法依赖的package包/类
/**
 * Creates a Duo Node, it is a Node that takes a Duo<T,T> as input,
 * transforms `A` with `sub1`, `B` with `sub2` and return their
 * tranformation through given transformer `t`.
 *
 * @param <T> input type.
 * @param <R> return type.
 * @param t transformer for this Node.
 * @param sub1 first  Node at `depth+1` in the tree, serves as first  parameter for `t`.
 * @param sub2 second Node at `depth+1` in the tree, serves as second parameter for `t`.
 * @return a new Node.
 */
public static <T,R> Node<Duo<T,T>,R> createDuoNode(final Transformer<Duo<Object,Object>,R> t,
      final Node<T,?> sub1, final Node<T,?> sub2)
{
   return new Node<Duo<T,T>,R>()
   {
      @Override
      public R exec(Duo<T, T> element)
      {
         Object o1 = sub1.exec(element.getA());
         Object o2 = sub2.exec(element.getB());
         return t.transform(new Duo<>(o1, o2));
      }
   };
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:27,代码来源:ExecutableExpressionTree.java

示例5: transform

import org.apache.commons.collections4.Transformer; //导入方法依赖的package包/类
/**
 * Transforms the input to result via each decorated transformer
 *
 * @param object  the input object passed to the first transformer
 * @return the transformed result
 */
public T transform(T object) {
    for (final Transformer<? super T, ? extends T> iTransformer : iTransformers) {
        object = iTransformer.transform(object);
    }
    return object;
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:13,代码来源:ChainedTransformer.java


注:本文中的org.apache.commons.collections4.Transformer.transform方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。