org.apache.solr.client.solrj.io.comp

## Class FieldComparator

- java.lang.Object
- - org.apache.solr.client.solrj.io.comp.FieldComparator

- All Implemented Interfaces:
    Serializable, Comparator<Tuple>, StreamComparator, Expressible

      public class FieldComparator
      extends Object
      implements StreamComparator

  An equality field Comparator which compares a field of two Tuples and determines sort order.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FieldComparator(String fieldName, ComparatorOrder order)`
    `FieldComparator(String leftFieldName, String rightFieldName, ComparatorOrder order)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compare(Tuple leftTuple, Tuple rightTuple)`
    `FieldComparator` | `copyAliased(Map<String,String> aliases)`
    `String` | `getLeftFieldName()`
    `ComparatorOrder` | `getOrder()`
    `String` | `getRightFieldName()`
    `boolean` | `hasDifferentFieldNames()`
    `boolean` | `isDerivedFrom(StreamComparator base)`
    `void` | `setLeftFieldName(String leftFieldName)`
    `void` | `setRightFieldName(String rightFieldName)`
    `Explanation` | `toExplanation(StreamFactory factory)` Returns an explanation about the stream object
    `StreamExpressionParameter` | `toExpression(StreamFactory factory)`

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

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

    - ### Methods inherited from interface java.util.Comparator

      `comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong`

- - ### Constructor Detail

    - #### FieldComparator

          public FieldComparator(String fieldName,
                                 ComparatorOrder order)

    - #### FieldComparator

          public FieldComparator(String leftFieldName,
                                 String rightFieldName,
                                 ComparatorOrder order)

  - ### Method Detail

    - #### setLeftFieldName

          public void setLeftFieldName(String leftFieldName)

    - #### getLeftFieldName

          public String getLeftFieldName()

    - #### setRightFieldName

          public void setRightFieldName(String rightFieldName)

    - #### getRightFieldName

          public String getRightFieldName()

    - #### getOrder

          public ComparatorOrder getOrder()

    - #### hasDifferentFieldNames

          public boolean hasDifferentFieldNames()

    - #### toExpression

          public StreamExpressionParameter toExpression(StreamFactory factory)

      Specified by:
        `toExpression` in interface `Expressible`

    - #### toExplanation

          public Explanation toExplanation(StreamFactory factory)
                                    throws IOException

      Description copied from interface: `Expressible`
      Returns an explanation about the stream object
      Specified by:
        `toExplanation` in interface `Expressible`
      Parameters:
        `factory` - Stream factory for this, contains information about the function name
      Returns:
        Explanation about this stream object containing explanations of any child stream objects
      Throws:
        `IOException` - throw on any error

    - #### compare

          public int compare(Tuple leftTuple,
                             Tuple rightTuple)

      Specified by:
        `compare` in interface `Comparator<Tuple>`

    - #### isDerivedFrom

          public boolean isDerivedFrom(StreamComparator base)

      Specified by:
        `isDerivedFrom` in interface `StreamComparator`

    - #### copyAliased

          public FieldComparator copyAliased(Map<String,String> aliases)

      Specified by:
        `copyAliased` in interface `StreamComparator`

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.