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

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

abstract class AbstractCompositeSpecification<T>
extends AbstractSpecification<T>
implements CompositeSpecification<T>

An abstract superclass for composite specifications.

This class defines the data structure of Domian composite specifications, consisting of:

Since:
0.1
Author:
Eirik Torske

Field Summary
protected  java.util.Set<Specification<? super T>> specifications
          The wrapped specifications.
 
Fields inherited from class net.sourceforge.domian.specification.AbstractSpecification
type
 
Constructor Summary
AbstractCompositeSpecification(java.lang.Class<T> type)
           
 
Method Summary
 CompositeSpecification<T> and(Specification<? super T> otherSpecification)
           
<F> CompositeSpecification<T>
and(java.lang.String accessibleObjectName, Specification<F> accessibleObjectSpecification)
           
 boolean equals(java.lang.Object otherObject)
           
protected  AbstractCompositeSpecification finalizeCreation()
          Should be invoked when building of this composite specification is to be completed.
(package private)  java.util.List<java.lang.String> getAccessibleObjectNameList()
           
(package private)  java.util.Set<Specification<?>> getAllSpecifications()
           
protected  void getAllSpecifications(java.util.Set<Specification<?>> specificationSet)
          Populates the given set of specifications with all Specification objects in this object graph.
(package private)  java.util.Map<java.lang.String,java.util.Set<LeafSpecification>> getLeafSpecificationMap()
           
protected  java.lang.Boolean hasConjunction()
           
protected  java.lang.Boolean hasDisjunction()
           
 int hashCode()
           
protected  java.lang.Boolean hasParameterization()
           
 java.lang.Boolean isGeneralizationOf(Specification<? extends T> specification)
           
 java.lang.Boolean isSatisfiedBy(T candidate)
           
protected  java.lang.Boolean isSimpleComposition()
           
 java.lang.Boolean isSpecialCaseOf(Specification<? super T> specification)
           
protected abstract  java.lang.Boolean isSpecifyingAllInstancesOfItsType()
           
 CompositeSpecification<T> or(Specification<? super T> otherSpecification)
           
<F> CompositeSpecification<T>
or(java.lang.String accessibleObjectName, Specification<F> accessibleObjectSpecification)
           
 CompositeSpecification<T> remainderUnsatisfiedBy(T candidate)
           
<F> CompositeSpecification<T>
where(java.lang.String accessibleObjectName, Specification<F> accessibleObjectSpecification)
           
(package private)  CompositeSpecification<T> wrapWithNewSpecification(AbstractCompositeSpecification<T> newSpecification, Specification<? super T> specificationToBeWrapped)
           
 
Methods inherited from class net.sourceforge.domian.specification.AbstractSpecification
containsSimpleCompositesOnly, containsValueBoundSpecificationsOnly, createValueBoundSpecification, getNegatedSpecification, getNumberOfLevelsOfNegations, getType, intersectsWith, invert, isDisjointWith, isIntersectionOf, isInvertible, isOddNumber, purify, 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, isDisjointWith
 

Field Detail

specifications

protected java.util.Set<Specification<? super T>> specifications
The wrapped specifications.

Constructor Detail

AbstractCompositeSpecification

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

finalizeCreation

protected AbstractCompositeSpecification finalizeCreation()
Should be invoked when building of this composite specification is to be completed.


where

public <F> CompositeSpecification<T> where(java.lang.String accessibleObjectName,
                                           Specification<F> accessibleObjectSpecification)
Specified by:
where in interface Specification<T>
Overrides:
where in class AbstractSpecification<T>

and

public <F> CompositeSpecification<T> and(java.lang.String accessibleObjectName,
                                         Specification<F> accessibleObjectSpecification)
Specified by:
and in interface CompositeSpecification<T>

or

public <F> CompositeSpecification<T> or(java.lang.String accessibleObjectName,
                                        Specification<F> accessibleObjectSpecification)
Specified by:
or in interface CompositeSpecification<T>

and

public CompositeSpecification<T> and(Specification<? super T> otherSpecification)
Specified by:
and in interface Specification<T>
Overrides:
and in class AbstractSpecification<T>

or

public CompositeSpecification<T> or(Specification<? super T> otherSpecification)
Specified by:
or in interface Specification<T>
Overrides:
or in class AbstractSpecification<T>

remainderUnsatisfiedBy

public CompositeSpecification<T> remainderUnsatisfiedBy(T candidate)
Specified by:
remainderUnsatisfiedBy in interface CompositeSpecification<T>

isSatisfiedBy

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

isGeneralizationOf

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

isSpecialCaseOf

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

hasConjunction

protected java.lang.Boolean hasConjunction()
Overrides:
hasConjunction in class AbstractSpecification<T>
Returns:
true if at least one of this specification's composites is a conjunction

hasDisjunction

protected java.lang.Boolean hasDisjunction()
Overrides:
hasDisjunction in class AbstractSpecification<T>
Returns:
true if at least one of this specification's composites is a disjunction

hasParameterization

protected java.lang.Boolean hasParameterization()
Returns:
true if this specification contains at least one parameterized sub-specification

isSimpleComposition

protected java.lang.Boolean isSimpleComposition()
Returns:
true if this (and only this, not any of its composites) composite specification consists of wrapped non-parametrized LeafSpecification only

getAllSpecifications

protected void getAllSpecifications(java.util.Set<Specification<?>> specificationSet)
Description copied from class: AbstractSpecification
Populates the given set of specifications with all Specification objects in this object graph. In other words, the Set is a flattened, unordered version of the Specification object graph.

Overrides:
getAllSpecifications in class AbstractSpecification<T>
Parameters:
specificationSet - Set of specifications

getAllSpecifications

java.util.Set<Specification<?>> getAllSpecifications()
Returns:
a flattened, unordered version of the Specification object graph, excluding this one.

getLeafSpecificationMap

java.util.Map<java.lang.String,java.util.Set<LeafSpecification>> getLeafSpecificationMap()
Returns:
a map of all leaf specifications with the accessible object (method/field) name as key

getAccessibleObjectNameList

java.util.List<java.lang.String> getAccessibleObjectNameList()
Returns:
a list of all accessible object (method/field) names

isSpecifyingAllInstancesOfItsType

protected abstract java.lang.Boolean isSpecifyingAllInstancesOfItsType()
Returns:
true if this specification will approve all possible instances of its declared type

wrapWithNewSpecification

CompositeSpecification<T> wrapWithNewSpecification(AbstractCompositeSpecification<T> newSpecification,
                                                   Specification<? super T> specificationToBeWrapped)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object otherObject)
Overrides:
equals in class java.lang.Object


Copyright © 2006-2010. All Rights Reserved.