edu.cs.ai.kreator.logic.metaconstraints
Class ExclusionConstraint

java.lang.Object
  extended by edu.cs.ai.kreator.logic.metaconstraints.ExclusionConstraint
All Implemented Interfaces:
Latexable, MetaConstraint

public class ExclusionConstraint
extends java.lang.Object
implements MetaConstraint

This class implements the MetaConstraint which excludes a set of constants from the substitution for a variable, e.g. [X != (anton, bert, cathy)]

Author:
Sebastian Loh, Matthias Thimm

Constructor Summary
ExclusionConstraint(Variable var, java.util.Collection<? extends Constant> consts)
          Creates a new ExclusionConstraint object with a given Variable and a given Collection of Constants.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Return true if other is a MetaConstraint and both have equal attributes.
 java.util.Set<Constant> getConstants()
           
 java.util.Set<Variable> getVariables()
          Returns all variables appearing in this constraint.
 int hashCode()
           
 boolean isValidSubstitution(java.util.Map<Variable,Constant> substitution)
          Checks if a given substitution violates this MetaConstraint.
 java.lang.String toLatex()
          Returns a Latex grammar conform string to generate variables, rules (conditionals) etc.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExclusionConstraint

public ExclusionConstraint(Variable var,
                           java.util.Collection<? extends Constant> consts)
Creates a new ExclusionConstraint object with a given Variable and a given Collection of Constants.

Parameters:
var - the Variable
consts - the Constants
Method Detail

isValidSubstitution

public boolean isValidSubstitution(java.util.Map<Variable,Constant> substitution)
Description copied from interface: MetaConstraint
Checks if a given substitution violates this MetaConstraint. E.g if this is a NotEqualConstraint like X!=Y, then substitution.get(X).equals(substitution.get(Y) == false will be returned. If this is an ExclusionConstraint X != (v_1, ... ,v_n) then substitution.get(X).equals(v_1) should hold for all 1<= i <= n.

Specified by:
isValidSubstitution in interface MetaConstraint
Parameters:
substitution - the substitution to check.
Returns:
true if the no MetaConstraint is violated by the given susbtitution.

toString

public java.lang.String toString()
Specified by:
toString in interface MetaConstraint
Overrides:
toString in class java.lang.Object
Returns:
a String representation of this MetaConstraint.

toLatex

public java.lang.String toLatex()
Description copied from interface: Latexable
Returns a Latex grammar conform string to generate variables, rules (conditionals) etc.

Specified by:
toLatex in interface Latexable
Specified by:
toLatex in interface MetaConstraint
Returns:
a Latex grammar conform string.

getVariables

public java.util.Set<Variable> getVariables()
Description copied from interface: MetaConstraint
Returns all variables appearing in this constraint.

Specified by:
getVariables in interface MetaConstraint
Returns:
all variables appearing in this constraint.

getConstants

public java.util.Set<Constant> getConstants()
Returns:
the Constants which this ExclusionConstraint excludes for the Variable.

hashCode

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

equals

public boolean equals(java.lang.Object obj)
Description copied from interface: MetaConstraint
Return true if other is a MetaConstraint and both have equal attributes.

Specified by:
equals in interface MetaConstraint
Overrides:
equals in class java.lang.Object
Parameters:
obj - a Object
Returns:
true if other is a MetaConstraint and both have equal attributes.