Class Multi_Value_Attribute<T extends Attribute>

  • All Implemented Interfaces:
    java.io.Serializable, java.util.Comparator<T>

    public class Multi_Value_Attribute<T extends Attribute>
    extends java.lang.Object
    implements java.util.Comparator<T>, java.io.Serializable
    See Also:
    Serialized Form
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(java.util.Collection<T> records)
      Add several records to this collection.
      void add​(T record)
      Add a record to this collection.
      void add​(T record, java.lang.Boolean force_add)
      Add a record to this collection.
      java.util.Collection<T> all_values()
      Fetch a clone of all the values in this collection.
      java.util.Collection<T> all_values​(java.lang.Boolean fetch_reference)
      Fetch either a reference, or a clone of all the values in this collection.
      int compare​(T object_1, T object_2)
      Compare two objects if their classes are the same.
      static Comparison_Result compare_for_commit​(Multi_Value_Attribute set1, Multi_Value_Attribute set2)
      Calculate the differences, and similarities, between two sets of Multi_Value_Attributes.
      static Comparison_Result compare_for_commit​(Multi_Value_Attribute set1, Multi_Value_Attribute set2, Attribute.COMPARISON_TYPE type)
      Calculate the differences, and similarities, between two sets of Multi_Value_Attributes.
      java.lang.Boolean contains_match​(java.lang.String regexp)
      Determine if a record exists within the collection.
      java.lang.Boolean contains_match​(java.util.regex.Pattern regexp)
      Determine if a record exists within the collection.
      T find​(java.lang.String record_handle)
      Find a record within the collection.
      int remove​(java.lang.String record_handle, java.lang.Boolean case_blind)
      Remove records from this collection.
      int remove​(java.lang.String record_handle, T record, java.lang.Boolean case_blind)
      Remove a record from this collection.
      int remove​(T record)
      Remove records from this collection.
      int remove​(T record, java.lang.Boolean case_blind)
      Remove records from this collection.
      int size()
      Get the number of records in the collection.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Comparator

        equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
    • Constructor Detail

      • Multi_Value_Attribute

        public Multi_Value_Attribute()
    • Method Detail

      • add

        public void add​(T record)
        Add a record to this collection. If it already exists, the old record will be replaced with record. record.compareTo (...) will be used to determine existence.
      • add

        public void add​(T record,
                        java.lang.Boolean force_add)
        Add a record to this collection. If it already exists, the old record will be replaced with record. record.compareTo (...) will be used to determine existence. If force_add is true, the record will always be added, never overwriting an existing record. This is useful in instances where the key will be changed later, but the record needs to be created now (for whatever reason).
      • remove

        public int remove​(T record,
                          java.lang.Boolean case_blind)
        Remove records from this collection. Optionally make a case blind comparison of unique_identifier ().
        See Also:
        remove(String,Boolean)
      • remove

        public int remove​(java.lang.String record_handle,
                          java.lang.Boolean case_blind)
        Remove records from this collection.
        Returns:
        The number of records removed.
      • remove

        public int remove​(java.lang.String record_handle,
                          T record,
                          java.lang.Boolean case_blind)
        Remove a record from this collection. The method unique_identifier () will be used for comparison against record_handle. All records with the same unique identifier will be removed. Additionally, record will be tested for equality (using ==) in case a record doesn't have a unique identifier.
        Returns:
        The number of records removed.
      • size

        public int size()
        Get the number of records in the collection.
      • find

        public T find​(java.lang.String record_handle)
        Find a record within the collection. A record is considered a match if unique_identifier () equals record_handle. Currently, only the first match will be returned.
      • contains_match

        public java.lang.Boolean contains_match​(java.lang.String regexp)
        Determine if a record exists within the collection. A record is considered a match if unique_identifier () matches regexp (case insensitive).
      • contains_match

        public java.lang.Boolean contains_match​(java.util.regex.Pattern regexp)
        Determine if a record exists within the collection. A record is considered a match if unique_identifier () matches regexp.
      • all_values

        public java.util.Collection<T> all_values()
        Fetch a clone of all the values in this collection.
      • all_values

        public java.util.Collection<T> all_values​(java.lang.Boolean fetch_reference)
        Fetch either a reference, or a clone of all the values in this collection.
      • compare_for_commit

        public static Comparison_Result compare_for_commit​(Multi_Value_Attribute set1,
                                                           Multi_Value_Attribute set2,
                                                           Attribute.COMPARISON_TYPE type)
                                                    throws java.lang.Exception
        Calculate the differences, and similarities, between two sets of Multi_Value_Attributes. The values are compared using Attribute.compare (...).
        Parameters:
        set1 - Multi_Value_Attributes to be compared
        set2 - Multi_Value_Attributes to be compared
        type - The data that should be compared
        Returns:
        The values sorted out into a Comparison_Result.
        Throws:
        java.lang.Exception
      • compare

        public int compare​(T object_1,
                           T object_2)
        Compare two objects if their classes are the same. Otherwise, compare their class name.
        Specified by:
        compare in interface java.util.Comparator<T extends Attribute>