uk.ac.starlink.table.join
Class CombinedMatchEngine

java.lang.Object
  |
  +--uk.ac.starlink.table.join.CombinedMatchEngine
All Implemented Interfaces:
MatchEngine

public class CombinedMatchEngine
extends Object
implements MatchEngine

A matching engine which provides matching facilities by combining the characteristics of a number of other matching engines. Because of the way it calculates bins (effectively multiplying one bin array by another), it is a good idea for efficiency's sake to keep down the number of bins returned by the MatchEngine.getBins(java.lang.Object[]) method of the component match engines.


Constructor Summary
CombinedMatchEngine(MatchEngine[] engines)
          Constructs a new MatchEngine based on a sequence of others.
 
Method Summary
 Object[] getBins(Object[] tuple)
          Returns a set of keys for bins into which possible matches for a given tuple might fall.
 DescribedValue[] getMatchParameters()
          Returns a set of DescribedValue objects whose values can be modified to modify the matching criteria.
 ValueInfo[] getTupleInfos()
          Returns a set of ValueInfo objects indicating what is required for the elements of each tuple.
 boolean matches(Object[] tuple1, Object[] tuple2)
          Indicates whether two tuples are to be linked.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CombinedMatchEngine

public CombinedMatchEngine(MatchEngine[] engines)
Constructs a new MatchEngine based on a sequence of others. The tuples accepted by this engine are composed of the tuples of its constituent engines (as specified by engines) concatenated in sequence.

Parameters:
engines - match engine sequence to be combined
Method Detail

matches

public boolean matches(Object[] tuple1,
                       Object[] tuple2)
Description copied from interface: MatchEngine
Indicates whether two tuples are to be linked.

Specified by:
matches in interface MatchEngine
Parameters:
tuple1 - one tuple
tuple2 - the other tuple
Returns:
true iff tuple1 should be considered a match for tuple2

getBins

public Object[] getBins(Object[] tuple)
Description copied from interface: MatchEngine
Returns a set of keys for bins into which possible matches for a given tuple might fall. The returned objects can be anything, but should have their equals and hashCode methods implemented properly for comparison.

Specified by:
getBins in interface MatchEngine
Parameters:
tuple -
Returns:
set of bin keys which might be returned by invoking this method on other tuples which count as matches for the submitted tuple

getTupleInfos

public ValueInfo[] getTupleInfos()
Description copied from interface: MatchEngine
Returns a set of ValueInfo objects indicating what is required for the elements of each tuple. The length of this array is the number of elements in the tuple. Each element should at least have a defined name and content class. The info's nullable attribute has a special meaning: if true it means that it makes sense for this element of the tuple to be always blank (for instance assigned to no column).

Specified by:
getTupleInfos in interface MatchEngine
Returns:
array of objects describing the requirements on each element of the tuples used for matching

getMatchParameters

public DescribedValue[] getMatchParameters()
Description copied from interface: MatchEngine
Returns a set of DescribedValue objects whose values can be modified to modify the matching criteria. Typically at least one of these will be some sort of tolerance separation which determines how close tuples must be to count as a match. This match engine's behaviour can be modified by calling DescribedValue.setValue(java.lang.Object) on the returned objects.

Specified by:
getMatchParameters in interface MatchEngine
Returns:
array of described values which influence the match

toString

public String toString()
Overrides:
toString in class Object

Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved.