## org.opencyc.constraintsolver
Class VariablesByAscendingDomainSizeComparator

    java.lang.Object
      |
      +--org.opencyc.constraintsolver.VariablesByAscendingDomainSizeComparator

All Implemented Interfaces:
  java.util.Comparator

public class VariablesByAscendingDomainSizeComparator
extends java.lang.Object
implements java.util.Comparator

Implements a `Comparator` to sort variables for the `checkForwardNonEvaluatableRule` method of the `ForwardCheckingSearcher` class.

Author:
  Stephen L. Reed

  Copyright 2001 Cycorp, Inc., license is open source GNU LGPL.

  the license

  www.opencyc.org

  OpenCyc at SourceForge

  THIS SOFTWARE AND KNOWLEDGE BASE CONTENT ARE PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENCYC ORGANIZATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE AND KNOWLEDGE BASE CONTENT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Field Summary
`protected ValueDomains` `valueDomains` Reference to the `ValueDomains` object for the parent `ConstraintProblem` object.

Constructor Summary
`VariablesByAscendingDomainSizeComparator(ValueDomains valueDomains)` Constructs a new VariablesByAscendingDomainSizeComparator object given a constraint problem.

Method Summary
`int` `compare(java.lang.Object variable1, java.lang.Object variable2)` Compares two variables by ascending size of their remaining domains.
`boolean` `equals(java.lang.Object object)` Returns `true` if some other object is equal to this `Comparator`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### valueDomains

    protected ValueDomains valueDomains

  Reference to the `ValueDomains` object for the parent `ConstraintProblem` object.

Constructor Detail

### VariablesByAscendingDomainSizeComparator

    public VariablesByAscendingDomainSizeComparator(ValueDomains valueDomains)

  Constructs a new VariablesByAscendingDomainSizeComparator object given a constraint problem.

Method Detail

### compare

    public int compare(java.lang.Object variable1,
                       java.lang.Object variable2)

  Compares two variables by ascending size of their remaining domains.
  Specified by:
    `compare` in interface `java.util.Comparator`
  Parameters:
    `variable1` - an variable for comparison
    `variable2` - variable for comparison.
  Returns:
    a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
  Throws:
    `ClassCastException` - - if the arguments' types prevent them from being compared by this Comparator

### equals

    public boolean equals(java.lang.Object object)

  Returns `true` if some other object is equal to this `Comparator`
  Specified by:
    `equals` in interface `java.util.Comparator`
  Overrides:
    `equals` in class `java.lang.Object`
  Parameters:
    `object` - the reference object with which to compare.
  Returns:
    `true` only if the specified object is also a comparator and it imposes the same ordering as this comparator.