AndSpecification.java
上传用户:hensond
上传日期:2021-12-27
资源大小:817k
文件大小:1k
- package com.company.section5;
- /**
- * @author cbf4Life cbf4life@126.com
- * I'm glad to share my knowledge with you all.
- */
- //实现and操作
- public class AndSpecification extends CompositeSpecification {
- //传递两个规格书进行and操作
- private IUserSpecification left;
- private IUserSpecification right;
-
- public AndSpecification(IUserSpecification _left,IUserSpecification _right){
- this.left = _left;
- this.right = _right;
- }
-
- //进行and运算
- @Override
- public boolean isSatisfiedBy(User user) {
- return left.isSatisfiedBy(user) && right.isSatisfiedBy(user);
- }
- }