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

java.lang.Object
  extended by net.sourceforge.domian.specification.AbstractSpecification<T>
      extended by net.sourceforge.domian.specification.AbstractValueBoundSpecification<T>
All Implemented Interfaces:
LeafSpecification<T>, Specification<T>, ValueBoundSpecification<T>
Direct Known Subclasses:
AbstractComparableValueBoundSpecification, EqualIgnoreCaseStringSpecification, EqualSpecification, NotEqualSpecification

abstract class AbstractValueBoundSpecification<T>
extends AbstractSpecification<T>
implements ValueBoundSpecification<T>

An abstract superclass for value bound specifications.

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

All objects given and then bound to this class are cloned, ensuring specification object immutability.

Since:
0.1
Author:
Eirik Torske
See Also:
ReflectionUtils.cloneOrDeepCopyIfNotImmutable(java.lang.Object), ReflectionUtils.DO_COPY_OBJECTS, ReflectionUtils.RECURSIVE_COPYING_DEPTH_TRESHOLD

Field Summary
protected  T originalValue
           
protected  T value
           
 
Fields inherited from class net.sourceforge.domian.specification.AbstractSpecification
type
 
Constructor Summary
AbstractValueBoundSpecification(T value)
           
 
Method Summary
 boolean equals(java.lang.Object otherObject)
           
protected  RelationalOperator getBinaryRelation()
           
protected abstract  RelationalOperator getBinaryRelation(java.lang.Boolean negated)
           
protected abstract  java.lang.Boolean getDisjointDecision(RelationalOperator candidateRelationalOperator, T candidateOperandValue)
           
 T getValue()
           
 int hashCode()
           
protected  Specification<T> invert()
           
 java.lang.Boolean isDisjointWith(Specification<?> specification)
           
 
Methods inherited from class net.sourceforge.domian.specification.AbstractSpecification
and, containsSimpleCompositesOnly, containsValueBoundSpecificationsOnly, createValueBoundSpecification, getAllSpecifications, getNegatedSpecification, getNumberOfLevelsOfNegations, getType, hasConjunction, hasDisjunction, intersectsWith, isGeneralizationOf, isIntersectionOf, isInvertible, isOddNumber, isSpecialCaseOf, or, purify, toString, where
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sourceforge.domian.specification.Specification
and, getType, isGeneralizationOf, isSatisfiedBy, isSpecialCaseOf, or, where
 

Field Detail

value

protected final T value

originalValue

protected final T originalValue
Constructor Detail

AbstractValueBoundSpecification

AbstractValueBoundSpecification(T value)
Method Detail

getValue

public T getValue()
Specified by:
getValue in interface ValueBoundSpecification<T>

getBinaryRelation

protected RelationalOperator getBinaryRelation()
Returns:
the mathematical binary relation bound to this value bound specification
Since:
0.5

getBinaryRelation

protected abstract RelationalOperator getBinaryRelation(java.lang.Boolean negated)
Parameters:
negated - when true the returned binary relation will be inverted
Returns:
the mathematical binary relation bound to this value bound specification
Since:
0.5

getDisjointDecision

protected abstract java.lang.Boolean getDisjointDecision(RelationalOperator candidateRelationalOperator,
                                                         T candidateOperandValue)
Returns:
true if the given candidate relation/operand pair leads to a disjoint relationship with this value bound specification
Since:
0.5

isDisjointWith

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

invert

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

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.