Package stanford.netdb
Class Multi_Value_Attribute<T extends Attribute>
- java.lang.Object
-
- stanford.netdb.Multi_Value_Attribute<T>
-
- 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
-
-
Constructor Summary
Constructors Constructor Description Multi_Value_Attribute()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(java.util.Collection<T> records)Add several records to this collection.voidadd(T record)Add a record to this collection.voidadd(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.intcompare(T object_1, T object_2)Compare two objects if their classes are the same.static Comparison_Resultcompare_for_commit(Multi_Value_Attribute set1, Multi_Value_Attribute set2)Calculate the differences, and similarities, between two sets of Multi_Value_Attributes.static Comparison_Resultcompare_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.Booleancontains_match(java.lang.String regexp)Determine if a record exists within the collection.java.lang.Booleancontains_match(java.util.regex.Pattern regexp)Determine if a record exists within the collection.Tfind(java.lang.String record_handle)Find a record within the collection.intremove(java.lang.String record_handle, java.lang.Boolean case_blind)Remove records from this collection.intremove(java.lang.String record_handle, T record, java.lang.Boolean case_blind)Remove a record from this collection.intremove(T record)Remove records from this collection.intremove(T record, java.lang.Boolean case_blind)Remove records from this collection.intsize()Get the number of records in the collection.
-
-
-
Method Detail
-
add
public void add(java.util.Collection<T> records)
Add several records to this collection.- See Also:
add(java.util.Collection<T>)
-
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)
Remove records from this collection.- See Also:
remove(String,Boolean)
-
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) throws java.lang.Exception
Calculate the differences, and similarities, between two sets of Multi_Value_Attributes. Using Attribute.COMPARISON_TYPE.SINGLE_VALUES as the comparison type.- Throws:
java.lang.Exception- See Also:
compare_for_commit(Multi_Value_Attribute,Multi_Value_Attribute,Attribute.COMPARISON_TYPE)
-
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 comparedset2- Multi_Value_Attributes to be comparedtype- The data that should be compared- Returns:
- The values sorted out into a Comparison_Result.
- Throws:
java.lang.Exception
-
-