nCodian logo banner 
   
  
   
 

Set Operations

set operations Venn diagram 

Summary

Included in the assembly with nCodian™ Flatfile is nCodian™ SetOperations. This class performs set operations on arrays of 32-bit integers. When the integers represent record numbers in a database, this class supports set operations on database records.

Supported Operations and Properties

The class supports the core operations Union, Intersection, Difference and Symmetric Difference. It supports the supplemental operations IsIncluded, IsEqual, IsDisjoint, and IsDisjointByIntersection. It maintains the properties Size, Min, and Max. It supports searching by the methods IsMember, Location, and Search.

Definitions

Union

The union of two sets is the new set that contains all the elements present in either of the two original sets, but without duplicates.

Intersection

The intersection of two sets is the new set that contains only those elements common to the original pair of sets.

Difference

The set difference A - B is the new set having all elements of A that are not in B. Difference is distinct from symmetric difference. It is also called one-sided difference and may be expressed as A - B. It matters which of the sets is treated as first and second, or left and right.

Symmetric Difference

The symmetric difference of A and B is the new set whose elements are in either A or B but not in both. Symmetric difference is also called an exclusive or operation, which may be written XOR.

Inclusion

One set is contained within another, i.e., every member of Set B is also a member of Set A.

Equality

All members of one set and only those members are also members of another set.

Disjoint Sets

Sets that have no members in common.

Size

The number of members in a set.

Min

The lowest value of members in a set.

Max

The highest value of members in a set.

Membership

Membership is a property of a specified item, whether it is a member a set.

Location

In set theory, the order of members is not important, but in an array implementation of sets, it may be useful to know the index of the array element storing a specified member. The Location method returns the zero-based index of the array element storing a specified value.

Search

In set theory, it is a property of sets that no value (member) is duplicated. This Search method supports a deviation from set theory by which the array storing a set may have duplicate values. It finds all locations of a value when there are or could be duplicates. The method returns an array of integers containing the zero-based element indices in the set array where a specified integer occurs or Nothing if the specified integer is not a member of the set.

 
 
Copyright © 2006-12 Synoptic Text Information Services, Inc.