uk.ac.ic.doc.automed.util
Class SetUtil

java.lang.Object
  extended by uk.ac.ic.doc.automed.util.SetUtil

public class SetUtil
extends java.lang.Object


Constructor Summary
SetUtil()
           
 
Method Summary
static java.util.Collection colIntersection(java.util.Collection col1, java.util.Collection col2)
           
static java.util.Collection copyCollection(java.util.Collection source)
          Make a shallow copy of a collection.
static java.util.Collection deepCopyCollection(java.util.Collection source)
          This is not a deep copy!!!!
static java.util.Set deepCopySet(java.util.Set source)
           
static boolean isIntersected(java.util.Collection col1, java.util.Collection col2)
           
static java.util.Set setDifference(java.util.Set set1, java.util.Set set2)
          Returns a Set containing the result of set1 - set2.
static java.util.Set setIntersection(java.util.Set set1, java.util.Set set2)
           
static java.util.Set setUnion(java.util.Set set1, java.util.Set set2)
           
static java.util.Collection subCollection(java.util.Collection s, int startInd, int endInd)
           
static boolean subsetOf(java.util.Set set1, java.util.Set set2)
           
static void unionAdd(java.util.Collection col1, java.util.Collection col2)
          add new objects from the second set to the first set
static java.util.Collection unionDistinct(java.util.Collection col1, java.util.Collection col2)
          create a new set that is a union of all the objects in both sets
keeping the input sets unchanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SetUtil

public SetUtil()
Method Detail

unionAdd

public static void unionAdd(java.util.Collection col1,
                            java.util.Collection col2)
add new objects from the second set to the first set

Parameters:
col1 -
col2 -

unionDistinct

public static java.util.Collection unionDistinct(java.util.Collection col1,
                                                 java.util.Collection col2)
create a new set that is a union of all the objects in both sets
keeping the input sets unchanged

Parameters:
col1 -
col2 -
Returns:

setUnion

public static java.util.Set setUnion(java.util.Set set1,
                                     java.util.Set set2)

setIntersection

public static java.util.Set setIntersection(java.util.Set set1,
                                            java.util.Set set2)

colIntersection

public static java.util.Collection colIntersection(java.util.Collection col1,
                                                   java.util.Collection col2)

isIntersected

public static boolean isIntersected(java.util.Collection col1,
                                    java.util.Collection col2)

setDifference

public static java.util.Set setDifference(java.util.Set set1,
                                          java.util.Set set2)
Returns a Set containing the result of set1 - set2.


copyCollection

public static java.util.Collection copyCollection(java.util.Collection source)
Make a shallow copy of a collection.

Parameters:
source -
Returns:

deepCopyCollection

public static java.util.Collection deepCopyCollection(java.util.Collection source)
This is not a deep copy!!!!

Parameters:
source -
Returns:

deepCopySet

public static java.util.Set deepCopySet(java.util.Set source)
                                 throws java.lang.InstantiationException,
                                        java.lang.IllegalAccessException
Throws:
java.lang.InstantiationException
java.lang.IllegalAccessException

subCollection

public static java.util.Collection subCollection(java.util.Collection s,
                                                 int startInd,
                                                 int endInd)

subsetOf

public static boolean subsetOf(java.util.Set set1,
                               java.util.Set set2)