Sugar version 1.13 Core API Specification

jp.ac.kobe_u.cs.sugar.csp
Class BooleanLiteral

java.lang.Object
  extended by jp.ac.kobe_u.cs.sugar.csp.Literal
      extended by jp.ac.kobe_u.cs.sugar.csp.BooleanLiteral

public class BooleanLiteral
extends Literal

This class implements a boolean literal of CSP.

See Also:
CSP

Constructor Summary
BooleanLiteral(BooleanVariable v, boolean negative)
          Constructs a new boolean literal of the given boolean variable and negative flag.
 
Method Summary
 void encode(Encoder encoder, int[] clause)
           
 BooleanVariable getBooleanVariable()
          Returns the boolean variable of CSP.
 int getCode()
           
 boolean getNegative()
          Returns the negative flag of the boolean literal.
 boolean isSatisfied()
          Returns true when the literal is satisfied.
 boolean isSimple()
          Always returns true since boolean literals are simple.
 boolean isUnsatisfiable()
           
 boolean isValid()
           
 int propagate()
           
 String toString()
          Returns the string representation of the boolean literal.
 
Methods inherited from class jp.ac.kobe_u.cs.sugar.csp.Literal
getBound, getVariables
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BooleanLiteral

public BooleanLiteral(BooleanVariable v,
                      boolean negative)
Constructs a new boolean literal of the given boolean variable and negative flag.

Parameters:
v - the boolean variable of CSP
negative - the negative flag
Method Detail

isSimple

public boolean isSimple()
Always returns true since boolean literals are simple.

Specified by:
isSimple in class Literal
Returns:
always true

getBooleanVariable

public BooleanVariable getBooleanVariable()
Returns the boolean variable of CSP.

Returns:
the boolean variable

getNegative

public boolean getNegative()
Returns the negative flag of the boolean literal.

Returns:
the negative flag

isValid

public boolean isValid()
                throws SugarException
Specified by:
isValid in class Literal
Throws:
SugarException

isUnsatisfiable

public boolean isUnsatisfiable()
                        throws SugarException
Specified by:
isUnsatisfiable in class Literal
Throws:
SugarException

propagate

public int propagate()
Specified by:
propagate in class Literal

isSatisfied

public boolean isSatisfied()
Description copied from class: Literal
Returns true when the literal is satisfied.

Specified by:
isSatisfied in class Literal
Returns:
true when the literal is satisfied

getCode

public int getCode()
Overrides:
getCode in class Literal

encode

public void encode(Encoder encoder,
                   int[] clause)
            throws SugarException,
                   IOException
Specified by:
encode in class Literal
Throws:
SugarException
IOException

toString

public String toString()
Returns the string representation of the boolean literal.

Overrides:
toString in class Object
Returns:
the string representation

Sugar version 1.13 Core API Specification

Sugar: A SAT-based Constraint Solver