Sugar version 1.13 Core API Specification

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

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

public class Clause
extends Object

This class implements a clause in CSP.

See Also:
CSP

Constructor Summary
Clause()
          Constructs a new clause.
Clause(List<Literal> literals)
          Constructs a new clause with give literals.
Clause(Literal literal)
           
 
Method Summary
 void add(Literal literal)
          Adds the given literal to the clause.
 void addAll(List<Literal> literals)
          Adds all given literals to the clause.
 void encode(Encoder encoder)
           
 String getComment()
          Returns the comment set to the clause.
 Set<IntegerVariable> getCommonVariables()
           
 List<Literal> getLiterals()
          Returns the literals of the clause.
 boolean isModified()
           
 boolean isSatisfied()
          Returns true when the clause is satisfied.
 boolean isSimple()
          Returns true when the clause is simple.
 boolean isUnsatisfiable()
           
 boolean isValid()
           
 int propagate()
           
 int removeFalsefood()
           
 void setComment(String comment)
          Sets the comment to the clause.
 int simpleSize()
           
 int size()
           
 String toString()
          Returns the string representation of the clause.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Clause

public Clause(List<Literal> literals)
Constructs a new clause with give literals.

Parameters:
literals - the literals of the clause

Clause

public Clause()
Constructs a new clause.


Clause

public Clause(Literal literal)
Method Detail

getLiterals

public List<Literal> getLiterals()
Returns the literals of the clause.

Returns:
literals the literals

addAll

public void addAll(List<Literal> literals)
Adds all given literals to the clause.

Parameters:
literals - the literals to be added

add

public void add(Literal literal)
Adds the given literal to the clause.

Parameters:
literal - the literal to be added.

size

public int size()

getComment

public String getComment()
Returns the comment set to the clause.

Returns:
the comment

setComment

public void setComment(String comment)
Sets the comment to the clause.

Parameters:
comment - the comment to set

isModified

public boolean isModified()

getCommonVariables

public Set<IntegerVariable> getCommonVariables()

simpleSize

public int simpleSize()

isSimple

public boolean isSimple()
Returns true when the clause is simple. A clause is simple when there is at most one non-simple literals.

Returns:
true when the clause is simple.
See Also:
Literal.isSimple()

isValid

public boolean isValid()
                throws SugarException
Throws:
SugarException

isUnsatisfiable

public boolean isUnsatisfiable()
                        throws SugarException
Throws:
SugarException

propagate

public int propagate()
              throws SugarException
Throws:
SugarException

removeFalsefood

public int removeFalsefood()
                    throws SugarException
Throws:
SugarException

isSatisfied

public boolean isSatisfied()
Returns true when the clause is satisfied.

Returns:
true when the clause is satisfied

encode

public void encode(Encoder encoder)
            throws SugarException,
                   IOException
Throws:
SugarException
IOException

toString

public String toString()
Returns the string representation of the clause.

Overrides:
toString in class Object
Returns:
the string representation

Sugar version 1.13 Core API Specification

Sugar: A SAT-based Constraint Solver