net.sourceforge.domian.specification
Class DisjunctionSpecification<T>

java.lang.Object
  extended by net.sourceforge.domian.specification.AbstractSpecification<T>
      extended by net.sourceforge.domian.specification.AbstractCompositeSpecification<T>
          extended by net.sourceforge.domian.specification.DisjunctionSpecification<T>
All Implemented Interfaces:
CompositeSpecification<T>, Specification<T>

final class DisjunctionSpecification<T>
extends AbstractCompositeSpecification<T>

A composite specification where at least one of the wrapped specifications must be satisfied for this overall composite specification to be satisfied.

The boolean logic operator equivalent is OR.

Since:
0.1
Author:
Eirik Torske

Field Summary
 
Fields inherited from class net.sourceforge.domian.specification.AbstractCompositeSpecification
specifications
 
Fields inherited from class net.sourceforge.domian.specification.AbstractSpecification
type
 
Constructor Summary
DisjunctionSpecification(java.lang.Class<T> type)
           
 
Method Summary
private  Specification<T> doBooleanAlgebraInversion()
           
protected  Specification<T> invert()
           
 java.lang.Boolean isDisjointWith(Specification<?> specification)
           
protected  java.lang.Boolean isInvertible()
           
 java.lang.Boolean isSatisfiedBy(T candidate)
           
protected  java.lang.Boolean isSpecifyingAllInstancesOfItsType()
           
protected  AbstractSpecification<T> purify(boolean doPurifyInversions)
          Purify this specification.
 
Methods inherited from class net.sourceforge.domian.specification.AbstractCompositeSpecification
and, and, equals, finalizeCreation, getAccessibleObjectNameList, getAllSpecifications, getAllSpecifications, getLeafSpecificationMap, hasConjunction, hasDisjunction, hashCode, hasParameterization, isGeneralizationOf, isSimpleComposition, isSpecialCaseOf, or, or, remainderUnsatisfiedBy, where, wrapWithNewSpecification
 
Methods inherited from class net.sourceforge.domian.specification.AbstractSpecification
containsSimpleCompositesOnly, containsValueBoundSpecificationsOnly, createValueBoundSpecification, getNegatedSpecification, getNumberOfLevelsOfNegations, getType, intersectsWith, isIntersectionOf, isOddNumber, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sourceforge.domian.specification.Specification
getType
 

Constructor Detail

DisjunctionSpecification

DisjunctionSpecification(java.lang.Class<T> type)
Method Detail

isSatisfiedBy

public java.lang.Boolean isSatisfiedBy(T candidate)
Specified by:
isSatisfiedBy in interface Specification<T>
Overrides:
isSatisfiedBy in class AbstractCompositeSpecification<T>

isDisjointWith

public java.lang.Boolean isDisjointWith(Specification<?> specification)
Specified by:
isDisjointWith in interface Specification<T>
Overrides:
isDisjointWith in class AbstractSpecification<T>

isSpecifyingAllInstancesOfItsType

protected java.lang.Boolean isSpecifyingAllInstancesOfItsType()
Specified by:
isSpecifyingAllInstancesOfItsType in class AbstractCompositeSpecification<T>
Returns:
true if this specification will approve all possible instances of its declared type

purify

protected AbstractSpecification<T> purify(boolean doPurifyInversions)
Description copied from class: AbstractSpecification
Purify this specification.

This may imply both simplification of the specification object graph, as well as applying boolean algebra on the overall logical expression.

Overrides:
purify in class AbstractSpecification<T>
Parameters:
doPurifyInversions - if false leave inversions alone (they must be purified only when spec creation is completed)
Returns:
a purified specification

isInvertible

protected java.lang.Boolean isInvertible()
Overrides:
isInvertible in class AbstractSpecification<T>

invert

protected Specification<T> invert()
Overrides:
invert in class AbstractSpecification<T>

doBooleanAlgebraInversion

private Specification<T> doBooleanAlgebraInversion()


Copyright © 2006-2010. All Rights Reserved.