rwth.i2.ltlrv.data
Class PropositionSet

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<E>
          extended by java.util.HashSet<IProposition>
              extended by rwth.i2.ltlrv.data.PropositionSet
All Implemented Interfaces:
Serializable, Cloneable, Iterable<IProposition>, Collection<IProposition>, Set<IProposition>

public class PropositionSet
extends HashSet<IProposition>

PropositionSet - A set of proposition with some additional functionality.

Author:
Eric Bodden
See Also:
Serialized Form

Constructor Summary
PropositionSet()
          Constructs an empty set.
PropositionSet(Collection<IProposition> propositions)
          Constructs a new set based on the collection of propositions given as input.
 
Method Summary
private  WeakValuesMap<String,Set<Object>> containedBindings()
          Returns the set of contained bindings in the form a={a2,a2},b={b2},... for bindings a=a1, a=a2 and b=b1.
 boolean containsMatchFor(IProposition prop)
          Returns true if this set contains a proposition which is matched by the given proposition.
 IProposition getEqual(IProposition proposition)
          Returns the unique proposition equal to proposition which is contained in this set or null if there is not such proposition.
 String toString()
          
private  Collection<WeakValuesMap<String,Object>> validCombinations(WeakValuesMap<String,Set<Object>> bindings)
          Returns an iterable over all valid combinations of a set of bindings.
private  void validCombinations(WeakValuesMap<String,Set<Object>> bindings, Map<String,Object> accummulator, Collection<WeakValuesMap<String,Object>> result)
          Returns an iterable over all valid combinations of a set of bindings.
 Iterable<WeakValuesMap<String,Object>> validCombinationsOfBindings()
          Returns an iterable over all valid combinations of bindings.
 
Methods inherited from class java.util.HashSet
add, clear, clone, contains, isEmpty, iterator, remove, size
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray
 

Constructor Detail

PropositionSet

public PropositionSet()
Constructs an empty set.


PropositionSet

public PropositionSet(Collection<IProposition> propositions)
Constructs a new set based on the collection of propositions given as input.

Parameters:
propositions - propositions the set should hold
Method Detail

getEqual

public IProposition getEqual(IProposition proposition)
Returns the unique proposition equal to proposition which is contained in this set or null if there is not such proposition.

Parameters:
proposition - search key
Returns:
proposition equal to proposition or null if there is none

containsMatchFor

public boolean containsMatchFor(IProposition prop)
Returns true if this set contains a proposition which is matched by the given proposition.

Parameters:
prop - the proposition which maybe matches one of the propositions of this set
Returns:
true if the proposition does match one of the contained propositions
See Also:
IProposition.matches(IProposition)

validCombinationsOfBindings

public Iterable<WeakValuesMap<String,Object>> validCombinationsOfBindings()
Returns an iterable over all valid combinations of bindings. That is the set product of all sets of bindings. for example, be given the bindings a=a1, a=a2 and b=b1, this will result in mappings a=a1, b=b1 and a=a2, b=b1.

Returns:
an iterable over all valid combinations of bindings

containedBindings

private WeakValuesMap<String,Set<Object>> containedBindings()
Returns the set of contained bindings in the form a={a2,a2},b={b2},... for bindings a=a1, a=a2 and b=b1.

Returns:
the set of contained bindings

validCombinations

private Collection<WeakValuesMap<String,Object>> validCombinations(WeakValuesMap<String,Set<Object>> bindings)
Returns an iterable over all valid combinations of a set of bindings. That is the set product of all sets of bindings. for example, be given the bindings a=a1, a=a2 and b=b1, this will result in mappings a=a1, b=b1 and a=a2, b=b1.

Parameters:
bindings - the set of bindings in the form a={a2,a2},b={b2},...
Returns:
an iterable over all valid combinations of bindings

validCombinations

private void validCombinations(WeakValuesMap<String,Set<Object>> bindings,
                               Map<String,Object> accummulator,
                               Collection<WeakValuesMap<String,Object>> result)
Returns an iterable over all valid combinations of a set of bindings. That is the set product of all sets of bindings. for example, be given the bindings a=a1, a=a2 and b=b1, this will result in mappings a=a1, b=b1 and a=a2, b=b1.

Parameters:
bindings - the set of bindings in the form a={a2,a2},b={b2},...
accummulator - accumulator, for temporary use only, must be empty at the beginning
result - the result is placed here

toString

public String toString()

Overrides:
toString in class AbstractCollection<IProposition>