package hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.neighbourhood import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.DefinedElement import java.util.Map import org.eclipse.collections.api.factory.Maps class PartialInterpretation2Hash extends PartialInterpretation2NeighbourhoodRepresentation{ new() { super(false, true) } override protected createLocalRepresentation(Map node2Representation, Map representation2Amount) { return new NeighbourhoodWithTraces( representation2Amount.hashCode,node2Representation.hashValues, null) } override protected createFurtherRepresentation(Map, Integer> nodeDescriptors, Map> node2Representation, NeighbourhoodWithTraces previous, boolean deepRepresentation) { return new NeighbourhoodWithTraces( nodeDescriptors.hashCode, node2Representation.hashValues, if(deepRepresentation) {previous} else {null}) } private def hashValues(Map map) { val hashedMap = Maps.mutable.ofInitialCapacity(map.size) for (entry : map.entrySet) { hashedMap.put(entry.key, entry.value.hashCode) } hashedMap } }