biz.hammurapi.rules.tutorial.rules
Class Validator

java.lang.Object
  extended by biz.hammurapi.config.ComponentBase
      extended by biz.hammurapi.rules.AbstractRule
          extended by biz.hammurapi.rules.Rule
              extended by biz.hammurapi.rules.tutorial.rules.Validator
All Implemented Interfaces:
biz.hammurapi.config.Component, biz.hammurapi.config.Context, biz.hammurapi.dispatch.InvocationTarget, biz.hammurapi.metrics.MeasurementCollector, biz.hammurapi.metrics.MeasurementConsumer, biz.hammurapi.rules.Constants

public class Validator
extends biz.hammurapi.rules.Rule


Nested Class Summary
 
Nested classes/interfaces inherited from class biz.hammurapi.rules.Rule
biz.hammurapi.rules.Rule.AcceptInfo, biz.hammurapi.rules.Rule.ChangeDetector
 
Field Summary
 
Fields inherited from class biz.hammurapi.config.ComponentBase
owner
 
Fields inherited from interface biz.hammurapi.rules.Constants
COLLECTION_MANAGER, DESCRIPTION, HANDLE_MANAGER, KNOWLEDGE_COMPACTOR, NAME, NEGATOR_CLASS, OBJECT_FILTER, RETAIN_NEGATORS, RULES, URI_DIRECT, URI_PROPERTY, WORKER_REF
 
Constructor Summary
Validator()
           
 
Method Summary
 void setLegalAge(int legalAge)
          Minimal age when people are allowed to marry.
 void validate(CloseRelative r1, CloseRelative r2)
          Close relatives can have only relationship of one type with each other.
 void validate(Parent parent)
          Validates that difference between parent and child age is not less than legal age.
 void validate(Relative relative)
          A person cannot be a relative of self.
 
Methods inherited from class biz.hammurapi.rules.Rule
getInvocationCounter, getInvocationHandlers, getRemoveHandlers, newChangeDetector, post, remove, reset, resetInvocationCounter, setMethodFactTypes, setMethodFactTypes, setMethodFactTypes, setMethodFactTypes, start, update
 
Methods inherited from class biz.hammurapi.rules.AbstractRule
getCollection, getDescription, getName, setDescription, setName, stop, toString
 
Methods inherited from class biz.hammurapi.config.ComponentBase
addMeasurement, get, getChild, getMeasurementConsumer, getOwner, getOwner, setMeasurementConsumer, setOwner
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Validator

public Validator()
Method Detail

validate

public void validate(Relative relative)
A person cannot be a relative of self.

Parameters:
relative -

validate

public void validate(CloseRelative r1,
                     CloseRelative r2)
Close relatives can have only relationship of one type with each other. Son is not supposed to marry his mother and sister shall not marry her brother. Conclusion which was inferred later that the other is negated. Relative's compareTo() is used for comparison.

Parameters:
r1 -
r2 -

setLegalAge

public void setLegalAge(int legalAge)
Minimal age when people are allowed to marry.

Parameters:
legalAge - Legal age in years

validate

public void validate(Parent parent)
Validates that difference between parent and child age is not less than legal age.

Parameters:
mother -


Copyright © 2006 Hammurapi Group. All Rights Reserved.