- 注册时间
- 2011-10-23
- 最后登录
- 2011-10-31
- 阅读权限
- 30
- 积分
- 421
- 精华
- 0
- 帖子
- 139
 
升级   73.67%
|
聚集把持:
package com.infosys.setl.fp;
import org.apache.commons.functor.UnaryPredicate;
import org.apache.commons.functor.core.composite.UnaryAnd;
import org.apache.commons.functor.core.composite.UnaryNot;
import org.apache.commons.functor.core.composite.UnaryOr;
public class SetOps
{
public static UnaryPredicate union(UnaryPredicate up1, UnaryPredicate up2)
{ return new UnaryOr(up1, up2);
} public static UnaryPredicate intersection(UnaryPredicate up1, UnaryPredicate up2)
{ return new UnaryAnd(up1, up2);
} public static UnaryPredicate difference(UnaryPredicate up1, UnaryPredicate up2)
{ return new UnaryAnd(up1, new UnaryNot(up2));
} public static UnaryPredicate symmetricDifference(UnaryPredicate up1, UnaryPredicate up2)
{ return difference(union(up1, up2), intersection(up1, up2));
}
} |
|