org.openmrs.logic.rule
Class AgeRule

java.lang.Object
  extended by org.openmrs.logic.rule.AgeRule
All Implemented Interfaces:
Rule

public class AgeRule
extends java.lang.Object
implements Rule

Calculates a person's age in years based from their date of birth to the index date


Constructor Summary
AgeRule()
           
 
Method Summary
 Result eval(LogicContext context, Patient patient, java.util.Map<java.lang.String,java.lang.Object> parameters)
          Evaluate rule for a given patient and applying the given criteria.
 Result.Datatype getDefaultDatatype()
          Gets the default datatype that the rule returns, when supplied with a given token.
 java.lang.String[] getDependencies()
          Returns a list of dependencies (tokens for rules upon which this rule may depend).
 java.util.Set<RuleParameterInfo> getParameterList()
          Returns the list of arguments.
 int getTTL()
          Gets the time (in seconds) during which the Rule's results are considered to be valid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgeRule

public AgeRule()
Method Detail

eval

public Result eval(LogicContext context,
                   Patient patient,
                   java.util.Map<java.lang.String,java.lang.Object> parameters)
            throws LogicException
Description copied from interface: Rule
Evaluate rule for a given patient and applying the given criteria.

Specified by:
eval in interface Rule
patient - a patient for whom rule is to be calculated
Returns:
result of the rule for the given patient with given criteria applied
Throws:
LogicException - TODO
See Also:
Rule.eval(org.openmrs.logic.LogicContext, org.openmrs.Patient, java.util.Map)

getParameterList

public java.util.Set<RuleParameterInfo> getParameterList()
Description copied from interface: Rule
Returns the list of arguments.

Specified by:
getParameterList in interface Rule
Returns:
list of arguments or null if no arguments
See Also:
org.openmrs.logic.rule.Rule#getParameterList()

getDependencies

public java.lang.String[] getDependencies()
Description copied from interface: Rule
Returns a list of dependencies (tokens for rules upon which this rule may depend).

Specified by:
getDependencies in interface Rule
Returns:
tokens for all rules that may be called by this rule
See Also:
org.openmrs.logic.rule.Rule#getDependencies()

getTTL

public int getTTL()
Description copied from interface: Rule
Gets the time (in seconds) during which the Rule's results are considered to be valid. This is used to prevent the use of invalid (old) items from a cache

Specified by:
getTTL in interface Rule
Returns:
duration (in seconds) the results are considered valid for this rule
See Also:
org.openmrs.logic.rule.Rule#getTTL()

getDefaultDatatype

public Result.Datatype getDefaultDatatype()
Description copied from interface: Rule
Gets the default datatype that the rule returns, when supplied with a given token. While results are loosely typed, this method allows rules to declare a default datatype to simplify user interfaces and defaults when working with rules.

Specified by:
getDefaultDatatype in interface Rule
Returns:
datatype
See Also:
org.openmrs.logic.rule.Rule#getDatatype(String)

OpenMRS-trunk

Generated May 29 2008 02:01 AM. NOTE - these libraries are in active development and subject to change