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