package it.univr.di.labeledvalue; import java.io.Serializable; import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Pattern; import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectList; import it.univr.di.Debug; /** * Abstract class for {@link it.univr.di.labeledvalue.LabeledIntMap} interface. * * @author Roberto Posenato * @see LabeledIntMap * @version $Id: $Id */ public abstract class AbstractLabeledIntMap implements LabeledIntMap, Serializable { /** * Admissible values as regular expression. */ static final String valueRE = "[ ,0-9∞" + Pattern.quote("-") + "]+"; /** * format of a labeled value as regular expression. */ static final String labeledValueRE = "(" + Label.LABEL_RE + valueRE + "|" + valueRE + Label.LABEL_RE + ")"; /** * logger */ static private Logger LOG = Logger.getLogger("AbstractLabeledIntMap"); /** * Matcher for a set of labeled values. */ static final Pattern patternLabelCharsRE = Pattern .compile(Pattern.quote("{") + "(" + Pattern.quote(Constants.OPEN_PAIR) + labeledValueRE + Pattern.quote(Constants.CLOSE_PAIR) + "[ ]*)*" + Pattern.quote("}")); /** * */ static final long serialVersionUID = 1L; /** * RE for splitting a list of labeled values. */ static final Pattern splitterEntry = Pattern .compile(Pattern.quote("{") + Pattern.quote("}") + "|[{" + Pattern.quote(Constants.OPEN_PAIR) + "]+|" + Pattern.quote(Constants.CLOSE_PAIR) + " [" + Constants.OPEN_PAIR + "} ]*"); /** * */ static final Pattern splitterPair = Pattern.compile(", "); /** * @param entry (label, value) * @return string representing the labeled value, i.e., "(value, label)" */ static final String entryAsString(final Entry