Package uk.ac.starlink.table.join

## Class JoinType

- java.lang.Object
- - uk.ac.starlink.table.join.JoinType

-     public abstract class JoinType
      extends java.lang.Object

  Defines how a set of matched rows from input tables (`RowLink` objects) are used to select rows for inclusion in an output table which represents the result of the matching operation. This corresponds to the type of the join in database terminology, though the naming of the instances of this class do not follow that terminology (left outer join etc), and the options here present a more complete set.

  Instances of this class are available as public static members of it. Currently, these instances should only be used with the results of pair matches (ones involving exactly two tables).

  Since:
    5 Sep 2005
  Author:
    Mark Taylor

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static JoinType` | `_1AND2` | Selects only rows with input from both input tables.
    `static JoinType` | `_1NOT2` | Selects only rows in the first input table which are not matched by any row in the second input table.
    `static JoinType` | `_1OR2` | Selects rows with input from either or both input tables.
    `static JoinType` | `_1XOR2` | Selects only rows with input from exactly one of the two input tables.
    `static JoinType` | `_2NOT1` | Selects only rows in the second input table which are not matched by any row in the first input table.
    `static JoinType` | `_ALL1` | Selects all output rows with input from the first input table.
    `static JoinType` | `_ALL2` | Selects all output rows with input from the second input table.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `abstract java.lang.String` | `getDescription()` | Returns a short textual description of this type.
    `java.lang.String` | `getName()` | Returns the name of this type.
    `static JoinType[]` | `getPairTypes()` | Returns a list of all the known types which apply to two-table matches.
    `abstract boolean` | `getUsedMatchFlag()` | Returns a value which indicates whether the matchScore is ever non-empty in the output table.
    `abstract boolean[]` | `getUsedTableFlags()` | Returns an array of flags indicating whether each of the tables in the input will ever have non-empty rows in the output.
    `abstract LinkSet` | `processLinks​(LinkSet links, int[] rowCounts)` | Turns a set of links which represent matches from the matching operation into a set of links which represent the rows to output.
    `java.lang.String` | `toString()` | Returns the name of this type.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### _1AND2

          public static final JoinType _1AND2

      Selects only rows with input from both input tables.

    - #### _1OR2

          public static final JoinType _1OR2

      Selects rows with input from either or both input tables.

    - #### _ALL1

          public static final JoinType _ALL1

      Selects all output rows with input from the first input table.

    - #### _ALL2

          public static final JoinType _ALL2

      Selects all output rows with input from the second input table.

    - #### _2NOT1

          public static final JoinType _2NOT1

      Selects only rows in the second input table which are not matched by any row in the first input table.

    - #### _1NOT2

          public static final JoinType _1NOT2

      Selects only rows in the first input table which are not matched by any row in the second input table.

    - #### _1XOR2

          public static final JoinType _1XOR2

      Selects only rows with input from exactly one of the two input tables.

  - ### Method Detail

    - #### processLinks

          public abstract LinkSet processLinks​(LinkSet links,
                                               int[] rowCounts)

      Turns a set of links which represent matches from the matching operation into a set of links which represent the rows to output. `links` is a set of `RowLink` objects; if the matching operation was between two tables, each element will represent a pair match (have two `RowRef`s, with table indices of 0 and 1 respectively). The ordering of `links` may influence the order of the returned collection. `links` may be modified by this method, and the returned value may or may not be the same object as the input `links` itself.
      Parameters:
        `links` - set of RowLinks representing actual matches
        `rowCounts` - numbers of rows in the tables on which the match was performed
      Returns:
        set of RowLinks representing rows for the output table

    - #### getUsedTableFlags

          public abstract boolean[] getUsedTableFlags()

      Returns an array of flags indicating whether each of the tables in the input will ever have non-empty rows in the output.
      Returns:
        2-element boolean array indicating whether first and second input tables appear in output

    - #### getUsedMatchFlag

          public abstract boolean getUsedMatchFlag()

      Returns a value which indicates whether the matchScore is ever non-empty in the output table.
      Returns:
        true iff the matchScore may be used in the output

    - #### getName

          public java.lang.String getName()

      Returns the name of this type.
      Returns:
        name

    - #### getDescription

          public abstract java.lang.String getDescription()

      Returns a short textual description of this type.
      Returns:
        description

    - #### toString

          public java.lang.String toString()

      Returns the name of this type.
      Overrides:
        `toString` in class `java.lang.Object`

    - #### getPairTypes

          public static JoinType[] getPairTypes()

      Returns a list of all the known types which apply to two-table matches.
      Returns:
        array of the 7 known types