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: 851 $
Author:
Roberto Posenato
See Also:
  • Field Details

    • valueRE

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

      static final Pattern valueREPattern
      Pattern of valueREString
    • labeledValueRE

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

      static final Pattern labeledValueSetREPattern
      Matcher for a set of labeled values. WARNING: After some test, I verified that this pattern cannot be used because it is too much 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 same 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. 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 be not 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 to parse 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 value (value with empty label included).
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object