com.ail.insurance.policy
Class RateBehaviour

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.RateBehaviour
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<AssessmentLine>

public class RateBehaviour
extends Behaviour

An assessment line which applies a rate behaviour - i.e. it applies a rate to the value of another line and optionally contributes the result to another line.

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

Field Summary
 
Fields inherited from class com.ail.core.Type
jXPathContext, NOT_PERSISTED
 
Constructor Summary
RateBehaviour()
          Default constructor
RateBehaviour(java.lang.String id, java.lang.String reason, Reference relatesTo, java.lang.String contributesTo, java.lang.String dependsOn, BehaviourType type, Rate rate)
          Constructor
RateBehaviour(java.lang.String id, java.lang.String reason, Reference relatesTo, java.lang.String contributesTo, java.lang.String dependsOn, BehaviourType type, Rate rate, int priority)
          Constructor
 
Method Summary
 boolean calculate(AssessmentSheetList sheets, AssessmentSheet sheet)
          Perform this lines calculation.
 java.lang.String getDependsOn()
          Get the name of the assessment sheet line that this line depends on.
 Rate getRate()
          Get the Rate for this line.
 void setDependsOn(java.lang.String dependsOn)
          Set the name of the assessment sheet line that this line depends on.
 void setRate(Rate rate)
          Set the Rate for this line.
 
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

RateBehaviour

public RateBehaviour()
Default constructor


RateBehaviour

public RateBehaviour(java.lang.String id,
                     java.lang.String reason,
                     Reference relatesTo,
                     java.lang.String contributesTo,
                     java.lang.String dependsOn,
                     BehaviourType type,
                     Rate rate)
Constructor

Parameters:
id - The Id to use for this line
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 one cntributes to.
dependsOn - The Id of the line that this on is derived from.
type - Behaviour type (Load or Discount)
rate - The rate to be used in the calculation.

RateBehaviour

public RateBehaviour(java.lang.String id,
                     java.lang.String reason,
                     Reference relatesTo,
                     java.lang.String contributesTo,
                     java.lang.String dependsOn,
                     BehaviourType type,
                     Rate rate,
                     int priority)
Constructor

Parameters:
id - The Id to use for this line
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 one cntributes to.
dependsOn - The Id of the line that this on is derived from.
type - Behaviour type (Load or Discount)
rate - The rate to be used in the calculation.
priority - The priority of this line wrt other lines in the same sheet (lines with higher priority values are processed first)
Method Detail

getDependsOn

public java.lang.String getDependsOn()
Get the name of the assessment sheet line that this line depends on.

Returns:
Name of an assessment sheet line

setDependsOn

public void setDependsOn(java.lang.String dependsOn)
Set the name of the assessment sheet line that this line depends on.

Parameters:
dependsOn - Name of an assessment sheet line

getRate

public Rate getRate()
Get the Rate for this line. This is the rate that this line will apply to the value of the 'dependsOn' line to derive its own value.

Returns:
This line's rate

setRate

public void setRate(Rate rate)
Set the Rate for this line. This is the rate that this line will apply to the value of the 'dependsOn' line to derive its own value.

Parameters:
rate - This line's rate

calculate

public boolean calculate(AssessmentSheetList sheets,
                         AssessmentSheet sheet)
Perform this lines calculation.

Specified by:
calculate in class CalculationLine
Parameters:
sheets - The sheets being evaluated
sheet - The sheet that this line is part of.
Returns:
true if the line is successfully evaluated, false otherwise.