uk.ac.starlink.table.join
Class SkyMatchEngine

java.lang.Object
  |
  +--uk.ac.starlink.table.join.SkyMatchEngine
All Implemented Interfaces:
MatchEngine
Direct Known Subclasses:
HEALPixMatchEngine, HTMMatchEngine

public abstract class SkyMatchEngine
extends Object
implements MatchEngine

Abstract superclass for match engines which match positions on the sky. The tuples it uses are two-element arrays of Number objects, the first giving Right Ascension in radians, and the second giving Declination in radians. The separation attribute indicates how many radians may separate two points on the celestial sphere for them to be considered matching.

Concrete superclasses will need to implement at least the MatchEngine.getBins(java.lang.Object[]) method.

Since:
15 Mar 2005

Field Summary
 
Fields inherited from interface uk.ac.starlink.table.join.MatchEngine
NO_BINS
 
Constructor Summary
SkyMatchEngine(double separation)
          Constructs a new match engine which considers two points (RA,Dec tuples) to match if they are within a given angular distance on the celestial sphere.
 
Method Summary
 boolean canBoundMatch()
          Indicates that the getMatchBounds(java.lang.Comparable[], java.lang.Comparable[]) method can be invoked to provide some sort of useful result.
 Comparable[][] getMatchBounds(Comparable[] radecMinIn, Comparable[] radecMaxIn)
          Given a range of tuple values, returns a range outside which no match to anything within that range can result.
 DescribedValue[] getMatchParameters()
          Returns a set of DescribedValue objects whose values can be modified to modify the matching criteria.
 double getSeparation()
          Returns the separation between points within which they will be considered to match.
 ValueInfo[] getTupleInfos()
          Returns a set of ValueInfo objects indicating what is required for the elements of each tuple.
 double matchScore(Object[] radec1, Object[] radec2)
          Matches two tuples representing RA,Dec coordinates if they are within separation radians of each other on the sky.
 void setSeparation(double separation)
          Configures this match engine to consider two points (RA,Dec tuples) to match if they are within a given angular distance on the celestial sphere.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface uk.ac.starlink.table.join.MatchEngine
getBins
 

Constructor Detail

SkyMatchEngine

public SkyMatchEngine(double separation)
Constructs a new match engine which considers two points (RA,Dec tuples) to match if they are within a given angular distance on the celestial sphere.

Parameters:
separation - match radius in radians
Method Detail

setSeparation

public void setSeparation(double separation)
Configures this match engine to consider two points (RA,Dec tuples) to match if they are within a given angular distance on the celestial sphere.

Parameters:
separation - match radius in radians

getSeparation

public double getSeparation()
Returns the separation between points within which they will be considered to match.

Returns:
match radius in radians

matchScore

public double matchScore(Object[] radec1,
                         Object[] radec2)
Matches two tuples representing RA,Dec coordinates if they are within separation radians of each other on the sky.

Specified by:
matchScore in interface MatchEngine
Parameters:
radec1 - 2-element array of Number objects giving RA & dec of first point
radec2 - 2-element array of Number objects giving RA & dec of second point
Returns:
distance in radians between radec1 and radec2 if they are close enough to match, otherwise -1

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

canBoundMatch

public boolean canBoundMatch()
Description copied from interface: MatchEngine
Indicates that the MatchEngine.getMatchBounds(java.lang.Comparable[], java.lang.Comparable[]) method can be invoked to provide some sort of useful result.

Specified by:
canBoundMatch in interface MatchEngine
Returns:
true iff getMatchBounds may provide useful information

getMatchBounds

public Comparable[][] getMatchBounds(Comparable[] radecMinIn,
                                     Comparable[] radecMaxIn)
Description copied from interface: MatchEngine
Given a range of tuple values, returns a range outside which no match to anything within that range can result. If the tuples on which this engine works represent some kind of space, the input values and output values specify a hyper-rectangular region of this space. In the common case in which the match criteria are based on proximity in this space up to a certain error, this method should return a rectangle which is like the input one but broadened in each direction by an amount corresponding to the error.

Both the input and output rectangles are specified by tuples representing its opposite corners; equivalently, they are the minimum and maximum values of each tuple element. In either the input or output min/max tuples, any element may be null to indicate that no information is available on the bounds of that tuple element (coordinate).

This method can be used by match algorithms which know in advance the range of coordinates they will match against and wish to reduce workload by not attempting matches which are bound to fail.

For example, a 1-d Cartesian match engine with an isotropic match error 0.5 would turn input values of ((0,200),(10,210)) into output values ((-0.5,199.5),(10.5,210.5)).

This method will only be called if MatchEngine.canBoundMatch() returns true. Thus engines that cannot provide any useful information along these lines (for instance because none of its tuple elements is Comparable do not need to implement it in a meaningful way.

Specified by:
getMatchBounds in interface MatchEngine
Parameters:
radecMinIn - tuple consisting of the minimum values of each tuple element in a possible match (to put it another way - coordinates of one corner of a tuple-space rectangle containing such a match)
radecMaxIn - tuple consisting of the maximum values of each tuple element in a possible match (to put it another way - coordinates of the other corner of a tuple-space rectangle containing such a match)
Returns:
2-element array of tuples - effectively (minTuple,maxTuple) broadened by errors
See Also:
MatchEngine.canBoundMatch()

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