com.ail.insurance.policy
Class SumBehaviour

java.lang.Object
  extended by com.ail.core.Type
      extended by com.ail.insurance.policy.AssessmentLine
          extended by com.ail.insurance.policy.CalculationLine
              extended by com.ail.insurance.policy.Behaviour
                  extended by com.ail.insurance.policy.SumBehaviour
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<AssessmentLine>

public class SumBehaviour
extends Behaviour

An assessment line which contributes a fixed sum to another line.

Version:
$Revision: 1.4 $
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.ail.core.Type
jXPathContext, NOT_PERSISTED
 
Constructor Summary
SumBehaviour()
          Default constructor
SumBehaviour(java.lang.String id, java.lang.String reason, Reference relatesTo, java.lang.String contributesTo, BehaviourType type, CurrencyAmount amount)
          Constructor
SumBehaviour(java.lang.String id, java.lang.String reason, Reference relatesTo, java.lang.String contributesTo, BehaviourType type, CurrencyAmount amount, int priority)
          Constructor
 
Method Summary
 boolean calculate(AssessmentSheetList sheets, AssessmentSheet sheet)
          Perform the calculation.
 
Methods inherited from class com.ail.insurance.policy.Behaviour
getType, getTypeAsString, setType, setTypeAsString
 
Methods inherited from class com.ail.insurance.policy.CalculationLine
getAmount, getAmountAsString, getContributesTo, setAmount, setContributesTo
 
Methods inherited from class com.ail.insurance.policy.AssessmentLine
compareTo, getCalculatedOrder, getId, getOrigin, getPriority, getReason, getRelatesTo, isDisabled, setCalculatedOrder, setDisabled, setId, setOrigin, setPriority, setReason, setRelatesTo
 
Methods inherited from class com.ail.core.Type
addAttribute, clone, deleteLock, deleteSerialVersion, fetchJXPathContext, getAttribute, getAttribute, getAttributeCount, getForeignSystemId, getLock, getSerialVersion, getSystemId, hasLock, hasSerialVersion, hasSystemId, isPersisted, markAsNotPersisted, mergeWithDataFrom, removeAttribute, removeAttribute, setAttribute, setForeignSystemId, setLock, setSerialVersion, setSystemId, xpathGet, xpathGet, xpathIterate, xpathSet
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SumBehaviour

public SumBehaviour()
Default constructor


SumBehaviour

public SumBehaviour(java.lang.String id,
                    java.lang.String reason,
                    Reference relatesTo,
                    java.lang.String contributesTo,
                    BehaviourType type,
                    CurrencyAmount amount)
Constructor

Parameters:
id - This line's Id
reason - Free text reson for this behaviour being created.
relatesTo - Optional reference to the part of the policy that caused this behaviour.
contributesTo - The Id of the line that this line contributes to.
type - The type of behaviour being represented.
amount - The amount (value) represented by this line.

SumBehaviour

public SumBehaviour(java.lang.String id,
                    java.lang.String reason,
                    Reference relatesTo,
                    java.lang.String contributesTo,
                    BehaviourType type,
                    CurrencyAmount amount,
                    int priority)
Constructor

Parameters:
id - This line's Id
reason - Free text reson for this behaviour being created.
relatesTo - Optional reference to the part of the policy that caused this behaviour.
contributesTo - The Id of the line that this line contributes to.
type - The type of behaviour being represented.
amount - The amount (value) represented by this line.
priority - The priority of this line wrt other lines in the same sheet (lines with higher priority values are processed first)
Method Detail

calculate

public boolean calculate(AssessmentSheetList sheets,
                         AssessmentSheet sheet)
Perform the calculation. For a FixedSum line this simply means take the amount property and apply it to the assessment line indicated by the contributeTo property. If the behaviour type is Load then amount will be added to the target line, if it is Discount it will be subtracted from it.

Specified by:
calculate in class CalculationLine
Parameters:
sheets - The sheets being evaluated
sheet - The sheet that this line is a member of.
Returns:
always true. FixedSum lines cannot fail to calculate.