Package 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
`FieldComparator​(String leftFieldName, String rightFieldName, ComparatorOrder order)`
`FieldComparator​(String fieldName, ComparatorOrder order)`

### Method Summary

All Methods Instance Methods Concrete Methods
`StreamComparator` `append​(StreamComparator other)`
`int` `compare​(Tuple leftTuple, Tuple rightTuple)`
`FieldComparator` `copyAliased​(Map<String,​String> aliases)`
`boolean` `equals​(Object o)`
`String` `getLeftFieldName()`
`ComparatorOrder` `getOrder()`
`String` `getRightFieldName()`
`boolean` `hasDifferentFieldNames()`
`int` `hashCode()`
`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, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

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

`reversed, 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`

#### append

    public StreamComparator append​(StreamComparator other)

Specified by:
  `append` in interface `StreamComparator`

#### equals

    public boolean equals​(Object o)

Specified by:
  `equals` in interface `Comparator<Tuple>`
Overrides:
  `equals` in class `Object`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`