Class AbstractLabeledIntMap

java.lang.Object
it.univr.di.labeledvalue.AbstractLabeledIntMap
All Implemented Interfaces:
LabeledIntMap, Serializable
Direct Known Subclasses:
LabeledIntHierarchyMap, LabeledIntSimpleMap, LabeledIntTreeMap

public abstract class AbstractLabeledIntMap extends Object implements LabeledIntMap
Abstract class for LabeledIntMap interface.
Version:
$Rev: 993 $
Author:
Roberto Posenato
See Also:
  • Field Details

    • valueRE

      static final String valueRE
      Admissible values as a regular expression. For now, only integers!
      See Also:
    • valueREPattern

      static final Pattern valueREPattern
      Pattern of valueREString
    • labeledValueRE

      static final String labeledValueRE
      A labeled value as a regular expression.
    • labeledValueSetREPattern

      static final Pattern labeledValueSetREPattern
      Matcher for a set of labeled values. WARNING: After some tests, I verified that this pattern cannot be used because it is too time-consuming.
      I maintain it as a check in some tests.
    • serialVersionUID

      static final long serialVersionUID
      Serial number
      See Also:
    • splitterEntryPattern

      static final Pattern splitterEntryPattern
      Pattern for splitting a set of labeled values.
    • splitterPair

      static final Pattern splitterPair
    • count

      int count
      The number of elements in the map
    • optimize

      boolean optimize
      Optimize. In some applications, it is important to maintain '¬C,0', and 'C,1'. The optimization would reduce them to '⊡,0' and 'C,1'. So, set false optimized to maintain '¬C,0', and 'C,1'. The default is true.
  • Constructor Details

    • AbstractLabeledIntMap

      public AbstractLabeledIntMap()
  • Method Details

    • entryAsString

      static String entryAsString(it.unimi.dsi.fastutil.objects.Object2IntMap.Entry<Label> entry)
      Parameters:
      entry - (label, value)
      Returns:
      string representing the labeled value, i.e., "(value, label)"
    • entryAsString

      public static String entryAsString(Label label, int value)
      Parameters:
      label - must not be null!
      value - the value to represent
      Returns:
      string representing the labeled value, i.e., "(value, label)"
    • parse

      public static LabeledIntMap parse(String inputMap)
      Parameters:
      inputMap - the string representing a set of labeled values
      Returns:
      a new labeled int map object
      See Also:
    • parse

      @Nullable public static LabeledIntMap parse(String inputMap, Class<? extends LabeledIntMap> labeledIntMapClass)
      Parse a string representing a LabeledValueTreeMap and return an object containing the labeled values represented by the string.

      The format of the string is given by the method toString(): {\[(<value>, <key>) \]*}.

      This method is also capable of parsing the old format: {\[(<key>, <value>) \]*}

      Parameters:
      inputMap - a String object.
      labeledIntMapClass - the class to manage the labeled values
      Returns:
      a LabeledValueTreeMap object if inputMap represents a valid map, null otherwise.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface LabeledIntMap
      Returns:
      true if the map has no elements.
    • size

      public int size()
      Specified by:
      size in interface LabeledIntMap
      Returns:
      the number of labeled values (value with empty label included).
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object