Class SolutionMappingsIndexForMixedUsage

java.lang.Object
se.liu.ida.hefquin.base.datastructures.impl.WrappingSolutionMappingsIndex
se.liu.ida.hefquin.base.datastructures.impl.SolutionMappingsIndexForMixedUsage
All Implemented Interfaces:
Iterable<SolutionMapping>, Collection<SolutionMapping>, SolutionMappingsIndex, StatsProvider

public class SolutionMappingsIndexForMixedUsage extends WrappingSolutionMappingsIndex
Wraps another SolutionMappingsIndex and, for every method that returns an Iterable of solution mappings, this implementation copies the Iterable returned by the wrapped index into a new list and, then, returns that list. This class can be used for cases in which adding and probing into such an index may happen concurrently. In such cases, there can be conflicts when the index is updated by one thread while another thread is still consuming an Iterable returned by one of the methods. Returning a copy of the Iterable avoids such conflicts.