it.unipd.dei.ims.nestor.experiment.utils
Class SetOperations

java.lang.Object
  extended by it.unipd.dei.ims.nestor.experiment.utils.SetOperations

public class SetOperations
extends java.lang.Object


Constructor Summary
SetOperations()
           
 
Method Summary
static int[] childrenNSMDifference(int[] array1, int[] array2)
          Implements the difference algorithm for the NSM.
static int[] disjointUnsortedUnion(int[] array1, int[] array2)
           
static int[] linearUnionAnc(int[] array1, int[] array2)
          Union which does not exploit the NS-M or INS-M characteristics.
static int[] NSMDifference(int[] array1, int[] array2)
          Implements the intersection algorithm for the NSM.
static int[] NSMUnion(int[] array1, int[] array2)
          This method returns the union of two sets in the NS-M.
static int[] NSMValuedDifference(int[] array1, AncestorObject[] ao)
           
static int[] sortedArraysIntersection(int[] a, int[] b)
           
static int[] sortedArraysIntersectionBinarySearch(int[] a, int[] b)
           
static int[] sortedArraysUnion(int[] a, int[] b)
           
static int[] tmpINSMDifference(int[] array1, int[] array2)
          Implements the intersection algorithm for the INSM.
static int[] union(int[] array1, int[] array2)
           
static int[] unionINSM(int[] array1, int[] array2)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SetOperations

public SetOperations()
Method Detail

sortedArraysUnion

public static int[] sortedArraysUnion(int[] a,
                                      int[] b)

sortedArraysIntersection

public static int[] sortedArraysIntersection(int[] a,
                                             int[] b)

sortedArraysIntersectionBinarySearch

public static int[] sortedArraysIntersectionBinarySearch(int[] a,
                                                         int[] b)

disjointUnsortedUnion

public static int[] disjointUnsortedUnion(int[] array1,
                                          int[] array2)

NSMUnion

public static int[] NSMUnion(int[] array1,
                             int[] array2)
This method returns the union of two sets in the NS-M. It exploits the fact that in a NS-C two sets can be 1) disjoint or 2) one proper subset of the other.

Parameters:
array1 - The first sorted array of integers.
array2 - The second sorted array of integers.
Returns:
The sorted array of integer representing the union of the inputs.

linearUnionAnc

public static int[] linearUnionAnc(int[] array1,
                                   int[] array2)
Union which does not exploit the NS-M or INS-M characteristics. It can be used for whichever sorted arrays of integers.

Parameters:
array1 -
array2 -
Returns:

union

public static int[] union(int[] array1,
                          int[] array2)

unionINSM

public static int[] unionINSM(int[] array1,
                              int[] array2)

NSMDifference

public static int[] NSMDifference(int[] array1,
                                  int[] array2)
Implements the intersection algorithm for the NSM. We assume that the NSC has not been updated. Array2 is assumed to be the smaller one.


NSMValuedDifference

public static int[] NSMValuedDifference(int[] array1,
                                        AncestorObject[] ao)

childrenNSMDifference

public static int[] childrenNSMDifference(int[] array1,
                                          int[] array2)
Implements the difference algorithm for the NSM. It can be used only for the Children operation. Array2 is assumed to be the smaller one.


tmpINSMDifference

public static int[] tmpINSMDifference(int[] array1,
                                      int[] array2)
Implements the intersection algorithm for the INSM. We assume that the INSC has not been updated. Array2 is assumed to be the smaller one.