Bulk Operations
Most types in the Function Development Kit represent built-in functions that provide access to bulks of objects.
They extend the types 'Bulk' and 'BuiltInFunction'.
Examples: Entity, Link, Event, ..
Bulk BuiltInFunction
It is common practice at Diafunc to work with types that represent bulks rather than single elements.
Even if you want to work with a single element only, you use a bulk type that only contains this element.
Therefore, most operations are bulk-oriented even though the types are named in the singular.
They extend the types 'Bulk' and 'BuiltInFunction'.
Examples: Entity, Link, Event, ..
It is common practice at Diafunc to work with types that represent bulks rather than single elements.
Even if you want to work with a single element only, you use a bulk type that only contains this element.
Therefore, most operations are bulk-oriented even though the types are named in the singular.
Union
Elements which are in A, in B, or in both A and B
Union
var union = a.union(b);Intersection
All elements of A that also belong to B
Intersection
var intersection = a.intersection(b);Difference
Elements of A that don't belong to B
Difference
var difference = a.difference(b);Symmetric Difference
Elements which are in either of the sets, but not in their intersection
Symmetric Difference
var symmetricDifference = a.symmetricDifference(b);Filtering and Sorting
Every bulk can be filtered with a custom predicate and sorted by a custom key extractor. For bulks of selections there are additional dedicated operations; filtering and sorting of selections is covered in detail on the Selections page.
Uniqueness
Filtering duplicate selections to ensure uniqueness
Uniqueness
var uniqueElements = a.distinct();Evaluation
The Function Development Kit (FDK) supports many built-in functions to evaluate a bulk:
Evaluation
var isDisjoint = a.disjoint(b);
var isSubset = a.subset(b);
var isProperSubset = a.properSubset(b);
var isSuperset = a.superset(b);
var isProperSuperset = a.properSuperset(b);
var allMatch = bulk.all(predicate);
var anyMatches = bulk.any(predicate);
var min3Match = bulk.min(3, predicate);
var exact3Match = bulk.exact(3, predicate);
var max3Match = bulk.max(3, predicate);
var noneMatch = bulk.none(predicate);
var count = bulk.count();
var exists = bulk.exists();
var notExists = bulk.notExists();