com.ail.insurance.policy
Class CalculationLine

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

public abstract class CalculationLine
extends AssessmentLine

A Calculation Line is an assessment line which contains a calculated element.

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

Field Summary
 
Fields inherited from class com.ail.core.Type
jXPathContext, NOT_PERSISTED
 
Constructor Summary
CalculationLine()
          Default constructor
CalculationLine(java.lang.String id, java.lang.String reason, Reference relatesTo, java.lang.String contributesTo, CurrencyAmount amount)
          Constructor
CalculationLine(java.lang.String id, java.lang.String reason, Reference relatesTo, java.lang.String contributesTo, CurrencyAmount amount, int priority)
          Constructor
 
Method Summary
abstract  boolean calculate(AssessmentSheetList sheets, AssessmentSheet sheet)
          Process this line's calculation
 CurrencyAmount getAmount()
           
 java.lang.String getAmountAsString()
          Return this line's amount in String format (e.g."421.20 GBP")
 java.lang.String getContributesTo()
           
 void setAmount(CurrencyAmount amount)
           
 void setContributesTo(java.lang.String contributesTo)
           
 
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

CalculationLine

public CalculationLine()
Default constructor


CalculationLine

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

Parameters:
id - Id for this calculation line
reason - Free text reason for the calculation line.
relatesTo - Optional reference to the part of the policy that cause the calculation line.
contributesTo - The id of the line that this one will contribute to.
amount - The amount (value) of this line.

CalculationLine

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

Parameters:
id - Id for this calculation line
reason - Free text reason for the calculation line.
relatesTo - Optional reference to the part of the policy that cause the calculation line.
contributesTo - The id of the line that this one will contribute to.
amount - The amount (value) of 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

getContributesTo

public java.lang.String getContributesTo()

setContributesTo

public void setContributesTo(java.lang.String contributesTo)

calculate

public abstract boolean calculate(AssessmentSheetList sheets,
                                  AssessmentSheet sheet)
Process this line's calculation

Parameters:
sheets - The list of assessment sheets currently being processed.
sheet - The sheet this line is part of.
Returns:
true if the line gets processed, false otherwise.

getAmount

public CurrencyAmount getAmount()

setAmount

public void setAmount(CurrencyAmount amount)

getAmountAsString

public java.lang.String getAmountAsString()
Return this line's amount in String format (e.g."421.20 GBP")

Returns:
Line's amount as a string, or "" if the line's amount is null.