org.opt4j.satdecoding
Class Term

java.lang.Object
  extended by org.opt4j.satdecoding.Term

public class Term
extends java.lang.Object

The Term is an element of the linear Constraint. The Term is an integer coefficient times a Literal.


Field Summary
protected  int coeff
           
protected  Literal lit
           
 
Constructor Summary
Term(int coeff, Literal lit)
          Constructs a Term.
 
Method Summary
 Term copy()
          Constructs a copy to this term.
 boolean equals(java.lang.Object other)
          A Term equals another Term if they have equal Literals and coefficients.
 int getCoefficient()
          Returns the coefficient.
 Literal getLiteral()
          Returns the literal.
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

coeff

protected final int coeff

lit

protected final Literal lit
Constructor Detail

Term

public Term(int coeff,
            Literal lit)
Constructs a Term.

Parameters:
coeff - the integer coefficient
lit - the literal must not be null
Method Detail

getCoefficient

public int getCoefficient()
Returns the coefficient.

Returns:
the coefficient

getLiteral

public Literal getLiteral()
Returns the literal.

Returns:
the literal

copy

public Term copy()
Constructs a copy to this term.

Returns:
a copy of this term

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object other)
A Term equals another Term if they have equal Literals and coefficients. This method checks, if this Term equals the given other Object.

Overrides:
equals in class java.lang.Object
Parameters:
other - the other object
Returns:
true if both are equal; false otherwise