Match operation implementation
You must create a class that extends abstract
gw.rating.rtm.matchop.StatelessMatchOperator. For an example, see gw.rating.rtm.matchop.StatelessLessThanOrEqualMatch.
The match operation implementation constructor accepts the following argument:
- An instance of RateTableMatchOp entity. This instance is part of the rate table definition.
Your new match operation implementation can provide implementations of methods from the base class, including the following methods.
Filter That Evaluates Row Under Consideration
This filter method signature is:
function filter(List<OrderedPersistenceAdapter>, Comparable, boolean):List<OrderedPersistenceAdapter> This in-memory filter evaluates all rows still under consideration, and returns only those rows which satisfy the conditions for the match operation. This filter is only called when the match operation is active. A corresponding relax method is not needed, because the list of results to be filtered are pre-partitioned according to whether the row would match a filter or a relax. The input results must be fully ordered and stay that way upon output. For more information about relaxing, see also Matching a factor in the rate table.
A stateless match operation doing in-memory
filtering expects its input to be in ascending order with respect to
the field or fields being matched by the match operation. For example,
a range match operation matches the fields int1 (minimum) and int2 (maximum. This operation
assumes that the rows are ordered according to increasing int1 value, with a tie being broken
by comparing the int2
values.
The output of the stateless match operation must be a list that is properly formatted for the next match operation. Therefore, the output must be in ascending order according to the field or fields matched by that next match operation.
To meet this requirement, PolicyCenter sorts the rate table when it is first loaded, using order by/then by sorting. The rate table is sorted by the first match operation’s columns. Then each region with equal values for the first match operation is sorted for the second match operation’s columns, and so on. A match operation controls how its rows are ordered by overriding the method:
compareRowValues(a : Comparable, b : Comparable) : intIf a match operation does
not naturally produce correctly-ordered output from this form of input,
it needs to reorder the rows as part of its filtering process. For most
match operations, an easy way to do this is to override the property
needsSubrangeMerge so
that it returns true.
The StatelessLessThanOrEqualMatch
provides an example of this.
Filter That Adds a Constraint to the Database Query
This filter method signature is:
function filter(Query<KeyableBean>, Comparable<Object>) Adds a constraint to the database query and returns the adjusted query.
Entity instances that are passed into
the above functions represent rate factor entities such as RateFactorRow, CoverageRateFactor, or any other
custom entity.
Method Which Computes a Score
This method signature is:
function getScore(OrderedPersistenceAdapter, Comparable) : Comparable) Used to compute a score for
the input argument, Comparable,
in relation to rate table row value, OrderedPersistenceAdapter.
This score is used during rate table matching to determine the best match.
