Class InstanceAssignment
java.lang.Object
java.util.AbstractMap<Collection<? extends Constant>,Integer>
java.util.HashMap<Collection<? extends Constant>,Integer>
org.tweetyproject.logics.rpcl.semantics.InstanceAssignment
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<Collection<? extends Constant>,
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,
V>, AbstractMap.SimpleImmutableEntry<K, V> -
Constructor Summary
ConstructorDescriptionInstanceAssignment
(Predicate predicate) Creates a new instance assignment for the given predicate with no assignments.InstanceAssignment
(Predicate predicate, Map<? extends Collection<? extends Constant>, Integer> map) Creates a new instance assignment for the given predicate with the given map. -
Method Summary
Modifier and TypeMethodDescriptionstatic Set
<InstanceAssignment> enumerateInstanceAssignments
(Predicate p, Set<Set<Constant>> constants) Determines the set of all instance assignments for the given predicate and equivalence classes.boolean
Returns the predicate of this assignment.int
hashCode()
int
Returns the number of constants assigned by this assignment, i.e.put
(Collection<? extends Constant> key, Integer value) toString()
Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, newHashMap, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Constructor Details
-
InstanceAssignment
Creates a new instance assignment for the given predicate with no assignments.- Parameters:
predicate
- a predicate.
-
InstanceAssignment
public InstanceAssignment(Predicate predicate, Map<? extends Collection<? extends Constant>, 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 Details
-
getPredicate
Returns the predicate of this assignment.- Returns:
- the predicate of this assignment.
-
put
- Specified by:
put
in interfaceMap<Collection<? extends Constant>,
Integer> - Overrides:
put
in classHashMap<Collection<? extends Constant>,
Integer>
-
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
- Overrides:
toString
in classAbstractMap<Collection<? extends Constant>,
Integer>
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfaceMap<Collection<? extends Constant>,
Integer> - Overrides:
hashCode
in classAbstractMap<Collection<? extends Constant>,
Integer>
-
equals
- Specified by:
equals
in interfaceMap<Collection<? extends Constant>,
Integer> - Overrides:
equals
in classAbstractMap<Collection<? extends Constant>,
Integer>
-
enumerateInstanceAssignments
public static Set<InstanceAssignment> enumerateInstanceAssignments(Predicate p, Set<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.
-