org.deduced.dynamic
Class AbstractDeducedProperty<E>

java.lang.Object
  extended by org.deduced.PropertyImplementation<E>
      extended by org.deduced.dynamic.AbstractDeducedProperty<E>
Type Parameters:
E - the type of value held within the property
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, DeducedProperty<E>, Property<E>
Direct Known Subclasses:
FixedDeducedProperty, RuleDeducedProperty

public abstract class AbstractDeducedProperty<E>
extends PropertyImplementation<E>
implements DeducedProperty<E>

AbstractDeducedProperty stores the common code of deduced properties to keep the use counter

Author:
Steve McDuff
See Also:
Serialized Form

Field Summary
private  ContextualPropertyCollection<?,?> parent
          parent collection that owns the rule
private  PropertyCollection rule
          the rule model
private static long serialVersionUID
          serialVersionUID
private  int useCounter
          number of times the rule is being used.
 
Constructor Summary
AbstractDeducedProperty(ContextualPropertyCollection<?,?> setParent, PropertyCollection<?,?> instance, E value, PropertyCollection<?,?> setRule)
          AbstractDeducedProperty constructor
 
Method Summary
 int decrementUseCounter()
          (non-JSDoc)
 void delete()
          (non-Javadoc)
protected abstract  void executeRule()
          execute the Rule
protected  void executeRuleAnalyzer(DeductionRuleAnalyzer<E> analyzer, java.lang.Object[] inputs)
          execute the Rule Analyzer and store the value based on the specified inputs.
 ContextualPropertyCollection<?,?> getParent()
          (non-Javadoc)
 PropertyCollection<?,?> getRule()
          (non-Javadoc)
 int getUseCounter()
          get Use Counter current value
 int incrementUseCounter()
          (non-JSDoc)
 void logRuleExecutionException(java.lang.Throwable e)
          log Rule Execution Exception
 
Methods inherited from class org.deduced.PropertyImplementation
arePropertiesEqual, arePropertyValuesEqual, clonePropertyValue, copy, equals, getInstance, getValue, getValueType, hashCode, isValueEqual, resetParentOnValue, setInstance, setValue, setValueOnProperty, setValueParent, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.deduced.Property
copy, getInstance, getValue, getValueType, isValueEqual, setValue
 

Field Detail

serialVersionUID

private static final long serialVersionUID
serialVersionUID

See Also:
Constant Field Values

parent

private ContextualPropertyCollection<?,?> parent
parent collection that owns the rule


rule

private PropertyCollection rule
the rule model


useCounter

private int useCounter
number of times the rule is being used. If the value is zero, avoid execution.

Constructor Detail

AbstractDeducedProperty

public AbstractDeducedProperty(ContextualPropertyCollection<?,?> setParent,
                               PropertyCollection<?,?> instance,
                               E value,
                               PropertyCollection<?,?> setRule)
AbstractDeducedProperty constructor

Parameters:
setParent - property parent
instance - property instance
value - initial value
setRule - rule
Method Detail

executeRule

protected abstract void executeRule()
execute the Rule


incrementUseCounter

public int incrementUseCounter()
(non-JSDoc)

Specified by:
incrementUseCounter in interface DeducedProperty<E>
Returns:
the current counter value. This value isn't guaranteed to be accurate as some types of properties don't track usage.
See Also:
DeducedProperty.incrementUseCounter()

decrementUseCounter

public int decrementUseCounter()
(non-JSDoc)

Specified by:
decrementUseCounter in interface DeducedProperty<E>
Returns:
the current counter value. This value isn't guaranteed to be accurate as some types of properties don't track usage.
See Also:
DeducedProperty.decrementUseCounter()

getUseCounter

public int getUseCounter()
get Use Counter current value

Returns:
the number of time the property is being used

logRuleExecutionException

public void logRuleExecutionException(java.lang.Throwable e)
log Rule Execution Exception

Parameters:
e - the unexpected exception

executeRuleAnalyzer

protected void executeRuleAnalyzer(DeductionRuleAnalyzer<E> analyzer,
                                   java.lang.Object[] inputs)
execute the Rule Analyzer and store the value based on the specified inputs.

Parameters:
analyzer - the rule analyzer
inputs - the rule inputs

getParent

public ContextualPropertyCollection<?,?> getParent()
(non-Javadoc)

Specified by:
getParent in interface DeducedProperty<E>
Returns:
the collection that owns the rule
See Also:
DeducedProperty.getParent()

delete

public void delete()
(non-Javadoc)

Specified by:
delete in interface DeducedProperty<E>
See Also:
DeducedProperty.delete()

getRule

public PropertyCollection<?,?> getRule()
(non-Javadoc)

Specified by:
getRule in interface DeducedProperty<E>
Returns:
the deduction rule model
See Also:
DeducedProperty.getRule()