de.uni_tuebingen.sfb.lichtenstein.formulas
Class Subset

java.lang.Object
  extended by de.uni_tuebingen.sfb.lichtenstein.formulas.FormulaImpl
      extended by de.uni_tuebingen.sfb.lichtenstein.formulas.AtomicFormula
          extended by de.uni_tuebingen.sfb.lichtenstein.formulas.Subset
All Implemented Interfaces:
Formula, Visitable, Serializable

public class Subset
extends AtomicFormula

A class for representing the atomic formula which says a variable is a subset of another variable

Author:
Hendrik Maryns
See Also:
Serialized Form

Constructor Summary
Subset(SetDenotator subSet, SetDenotator superSet)
          Initialize a new subset formula, involving the variable which is a subset and the variable which is a superset.
 
Method Summary
 void accept(FormulaVisitor visitor)
          Accept a formula visitor.
protected  Set<Predicate> computePredicates()
          Return all predicates in this formula.
protected  Set<Variable> computeVariables()
          Simply return the two variables.
 boolean containsVariable(Variable var)
          Returns whether this formula contains the given variable.
 boolean equals(Object other)
          Indicates whether some other object is “equal to” this one.
 SetDenotator getSubsetVariable()
          Returns the subset variable.
 SetDenotator getSupersetVariable()
          Returns the superset variable.
 int hashCode()
          Returns a hash code value for the object.
 String toString()
          Returns a string representation of the object.
 
Methods inherited from class de.uni_tuebingen.sfb.lichtenstein.formulas.AtomicFormula
getNormalForm, isFree
 
Methods inherited from class de.uni_tuebingen.sfb.lichtenstein.formulas.FormulaImpl
and, exists, exists, forAll, forAll, getFreeVariables, getPredicates, getVariables, iff, implies, isClosed, not, or
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Subset

public Subset(SetDenotator subSet,
              SetDenotator superSet)
Initialize a new subset formula, involving the variable which is a subset and the variable which is a superset.

Parameters:
subSet - The variable which is a subset.
superSet - The variable which is a superset.
Precondition:
Both variables must be effective. | subSet != null && superSet != null
Postconditions:
  • The subset variable is set to the given subset variable. | new.getSubsetVariable() == subSet
  • The superset variable is set to the given superset variable. | new.getSupersetVariable() == superSet
  • Method Detail

    getSubsetVariable

    public SetDenotator getSubsetVariable()
    Returns the subset variable.

    Returns:
    The first variable.

    getSupersetVariable

    public SetDenotator getSupersetVariable()
    Returns the superset variable.

    Returns:
    The second variable.

    computeVariables

    protected Set<Variable> computeVariables()
    Simply return the two variables.

    Specified by:
    computeVariables in class FormulaImpl
    Returns:
    The two variables in the right order. | result.size() == 2 && | result.contains(getSubsetVariable()) && | result.contains(getSupersetVariable())

    containsVariable

    public boolean containsVariable(Variable var)
    Returns whether this formula contains the given variable.

    Parameters:
    var - The variable to check.
    Returns:
    A subset formula does not contain any first order variables. | result == false

    computePredicates

    protected Set<Predicate> computePredicates()
    Return all predicates in this formula.

    Specified by:
    computePredicates in class FormulaImpl
    Returns:
    Both variables can be a predicate. | if ( getSubsetVariable() instanceof Predicate ) | then result.contains(getSubsetVariable()) | if ( getSupersetVariable() instanceof Predicate ) | then result.contains(getSupersetVariable())

    equals

    public boolean equals(Object other)
    Indicates whether some other object is “equal to” this one.

    Overrides:
    equals in class FormulaImpl
    Returns:
    Two subset atomic formulas are equal if they compare the same variables. | let otherSubset = (Subset) other in | if ( otherSubset.getSubsetVariable() == getSubsetVariable() ) | then result == false | else if ( otherSubset.getSupersetVariable() == getSupersetVariable() ) | then result == false | else result == true

    hashCode

    public int hashCode()
    Returns a hash code value for the object.

    Specified by:
    hashCode in class FormulaImpl
    Returns:
    The hash code is based on the hash codes of the variables and of the characteristic symbol. | result == getSubsetVariable().hashCode() + "⊂".hashCode() + getSupersetVariable().hashCode()

    toString

    public String toString()
    Returns a string representation of the object.

    Specified by:
    toString in class FormulaImpl
    Returns:
    The string representations of the variables are given, with the unicode symbol SUBSET OF: ⊂ in between them. | result == getSubsetVariable().toString() + "⊂" + getSupersetVariable().toString()

    accept

    public void accept(FormulaVisitor visitor)
                throws VisitorException
    Accept a formula visitor. The iteration is done by the visitor, not by the composed formulas.

    Parameters:
    visitor - The visitor that is to be accepted to do its work.
    Throws:
    VisitorException - [CAN] A visitor can throw an exception.


    © Copyright 2008 Hendrik Maryns   Creative Commons License