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