// SPDX-FileCopyrightText: 2020 Roberto Posenato // // SPDX-License-Identifier: LGPL-3.0-or-later package it.univr.di.labeledvalue; import it.unimi.dsi.fastutil.ints.IntSet; import it.unimi.dsi.fastutil.objects.AbstractObject2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry; import it.unimi.dsi.fastutil.objects.ObjectSet; import javax.annotation.Nonnull; import java.io.Serial; import java.io.Serializable; import java.util.Comparator; import java.util.Map; /** * Realizes the map {@link Label}-->int *

* The semantics of a set of labeled values is defined in the paper
“The Dynamic Controllability of Conditional STNs with Uncertainty.”
by Hunsberger, * Luke, Roberto Posenato, and Carlo Combi. 2012. https://arxiv.org/abs/1212.2005. *

* All methods managing a single labeled value have to make a defensive copy of the label in order to guarantee that the label insert/get is a copy of the label * given/requested.
All methods managing bundle of labeled values do not have to make a defensive copy for performance reasons. * * @author Robert Posenato * @version $Rev$ */ public interface LabeledIntMap extends Serializable { // I do not extend Object2IntMap

* Not mandatory: the method can remove or modify other labeled values of the set in order to minimize the labeled values present guaranteeing that no info * is lost. * * @param l a not null label. * @param i a not {@link it.univr.di.labeledvalue.Constants#INT_NULL} value. * * @return true if {@code (l,i)} has been inserted. Since an insertion can remove more than one redundant labeled values, it is nonsensical to return "the * old value" as expected from a classical put method. */ boolean put(Label l, int i); /** * Put the labeled value without any control. It is dangerous, but it can help in some cases. * * @param l a {@link it.univr.di.labeledvalue.Label} object. * @param i the new value. */ void putForcibly(Label l, int i); /** * Remove the label {@code l} from the map. If the {@code l} is not present, it does nothing. * * @param l a not null label. * * @return the previous value associated with {@code l}, or {@link it.univr.di.labeledvalue.Constants#INT_NULL} if there was no mapping for {@code l}. */ int remove(@Nonnull Label l); /** * @return a read-only view of this. */ @SuppressWarnings("ClassReferencesSubclass") LabeledIntMapView unmodifiable(); }