Class InstanceAssignment
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<java.util.Collection<? extends Constant>,java.lang.Integer>
-
- net.sf.tweety.logics.rpcl.semantics.InstanceAssignment
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.util.Map<java.util.Collection<? extends Constant>,java.lang.Integer>
public class InstanceAssignment extends java.util.HashMap<java.util.Collection<? extends Constant>,java.lang.Integer>
Instances of this class represent assignenment of true instances for a given predicate wrt. to a set of constants.- Author:
- Matthias Thimm
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description InstanceAssignment(Predicate predicate)
Creates a new instance assignment for the given predicate with no assignments.InstanceAssignment(Predicate predicate, java.util.Map<? extends java.util.Collection<? extends Constant>,java.lang.Integer> map)
Creates a new instance assignment for the given predicate with the given map.
-
Method Summary
Modifier and Type Method Description static java.util.Set<InstanceAssignment>
enumerateInstanceAssignments(Predicate p, java.util.Set<java.util.Set<Constant>> constants)
Determines the set of all instance assignments for the given predicate and equivalence classes.boolean
equals(java.lang.Object obj)
Predicate
getPredicate()
Returns the predicate of this assignment.int
hashCode()
int
numberOfConstants()
Returns the number of constants assigned by this assignment, i.e.java.lang.Integer
put(java.util.Collection<? extends Constant> key, java.lang.Integer value)
java.lang.String
toString()
-
-
-
Constructor Detail
-
InstanceAssignment
public InstanceAssignment(Predicate predicate)
Creates a new instance assignment for the given predicate with no assignments.- Parameters:
predicate
- a predicate.
-
InstanceAssignment
public InstanceAssignment(Predicate predicate, java.util.Map<? extends java.util.Collection<? extends Constant>,java.lang.Integer> map)
Creates a new instance assignment for the given predicate with the given map.- Parameters:
predicate
- a predicate.map
- a map mapping sets of constants to integers.
-
-
Method Detail
-
getPredicate
public Predicate getPredicate()
Returns the predicate of this assignment.- Returns:
- the predicate of this assignment.
-
put
public java.lang.Integer put(java.util.Collection<? extends Constant> key, java.lang.Integer value)
-
numberOfConstants
public int numberOfConstants()
Returns the number of constants assigned by this assignment, i.e. the sum of the values in this map.- Returns:
- the number of constants assigned by this assignment.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.util.AbstractMap<java.util.Collection<? extends Constant>,java.lang.Integer>
-
hashCode
public int hashCode()
-
equals
public boolean equals(java.lang.Object obj)
-
enumerateInstanceAssignments
public static java.util.Set<InstanceAssignment> enumerateInstanceAssignments(Predicate p, java.util.Set<java.util.Set<Constant>> constants)
Determines the set of all instance assignments for the given predicate and equivalence classes.- Parameters:
p
- a predicate.constants
- a set of constants.- Returns:
- a set of instance assignments.
-
-